AsyncLoop
This is the event loop that schedules and runs every coroutine passed to it using the run
method. It will create a number of consumer threads that process coroutines concurrently.
graph BT
N1["AsyncLoop"] -->|inherits| N2["Any"];
Characteristics
Quality | Value |
---|---|
Inherits | global.Any |
Extends | N/A |
Decorators | #sealed; |
Is enum | false |
Is sealed | true |
Is extern | false |
Is abstract | false |
Is generator | false |
Has value semantics | false |
Has stored properties | true |
Should register destructor | false |
Has atomic memory | false |
Is copy assignable | false |
Is zero initializable | false |
Functions
__consumer
__consumer (loop AsyncLoop) -> Nil
__router
__router (loop AsyncLoop) -> Nil
Methods
construct
construct (s strictly @Self, concurrency: Int64 = 0) -> Self
concurrency
.
run
run (s @Self, coro nom Coroutine) -> Future
signal
signal (s @Self) -> Nil
To signal to the loop that a value has become available due to external causes you can use this function which will make the loop re-run every coroutine again looking for a change.
shutdown
shutdown (s @Self) -> Nil
The loop cannot be used after calling this function.
Properties
__active_q
__active_q ConcurrentQueue[nom Coroutine, SpinMutex, SpinMutex]?()
__consume_q
__consume_q ConcurrentQueue[nom Coroutine, SpinMutex, SpinMutex]?()
__sem
__sem Semaphore
__shutdown_sem
__shutdown_sem Semaphore
__concurrency
__concurrency Int64
__in_flight_coros
__in_flight_coros NInt