madmachineio / SwiftIO

A Swift framework for microcontrollers abstraction layer.
https://madmachineio.github.io/SwiftIO/documentation/swiftio
MIT License
185 stars 14 forks source link

Question: libdispatch alternative #28

Open maxeeem opened 1 year ago

maxeeem commented 1 year ago

Hello πŸ‘‹

I just got my SwiftIO Maker Kit yesterday and first off, thank you!

I'm relatively new to embedded development and my understanding is that libdispatch is not supported (based on this post). I have some project code that I would like to run on the board which uses dispatch queues, mainly to synchronize access to shared resources and for some async code. Do you have any suggestions or resources you can point me to on how I can adapt my code to the embedded use case without using Dispatch?

Thank you

Ines333 commented 1 year ago

Hi @maxeeem,

Thanks for your kind support!

We are actually investigating this feature, to see if it’s possible to replace libdispatch directly at the Zephyr level. Plz stay tuned : )

lhoward commented 1 year ago

Haven't looked into this in any detail, but a custom Executor that supported Zephyr work queues may be a more modern approach that integrates with Swift structured concurrency.

[1] https://github.com/apple/swift-evolution/blob/main/proposals/0392-custom-actor-executors.md#custom-actor-executors [2] https://docs.zephyrproject.org/latest/kernel/services/threads/workqueue.html