You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi @diggit, runloops are a semi-experimental feature that are partially derived from runloops on macOS and iOS (and NeXTStep before then).
They currently serve two purposes:
timer control
waiting on multiple queues
The benefit of a real timer object instead of using sleep or sleep_until is that you can easily have multiple timers with different timeouts running on the same thread, as well as mixed one-shot and periodic timers. In most RTOSes, all timers run on a single, low-priority timer thread. Using runloops for timers in Argon gives you control over timer priority at the expense of having to create your own thread+runloop.
Any number of queues can also be linked to a runloop. If a linked queue receives an item, the runloop will exit and tell you which queue received so you can read the item and process it.
For a specific use case, runloops work very nicely for UI threads, i.e., for event- or message-handling threads that may need to perform some periodic work of their own.
I'm open to ideas for improving runloops! (And I'll move some of this explanatory text into the doxygen docs.)
Hi,
I am a little bit confused by Runloop usage.
The text was updated successfully, but these errors were encountered: