Asynchronous Trigger
AsyncTrigger offers a simple synchronization for producer-consumer scenario:
- There is one or more suspended flows waiting for some event
- There is one or more signaling flows
The trigger offers the following methods for resuming and suspending the callers:
Signalmethod allows to resume one or more suspended callersWaitAsyncsuspends the caller until the call ofSignalSignalAndWaitAsyncis an atomic combination ofSignalandWaitAsyncmethods
Signaling method behaves in two ways:
- Resume all suspended callers
- Resume the first waiting caller in the queue
AsyncTrigger differs from AsyncAutoResetEvent synchronization primitive in the following aspects:
- There is no signaled state of the trigger. Therefore, any call to
WaitAsyncwill be suspended and can be resumed only withSignalmethod - The trigger can resume all suspended callers
SignalAndWaitAsyncallows to build a queue of signaling flows