github.com/koko1123/flow-go-1@v0.29.6/engine/Readme.md (about)

     1  # Notifier
     2  
     3  The Notifier implements the following state machine
     4  ![Notifier State Machine](/docs/NotifierStateMachine.png)
     5  
     6  The intended usage pattern is:
     7  * there are goroutines, aka `Producer`s, that append work to a queue `pendingWorkQueue`
     8  * there is a number of goroutines, aka `Consumer`s, that pull work from the `pendingWorkQueue`
     9     * they consume work until they have drained the `pendingWorkQueue`
    10     * when they find that the `pendingWorkQueue` contains no more work, they go back to 
    11       the notifier and await notification 
    12  
    13  ![Notifier Usage Pattern](/docs/NotifierUsagePattern.png)
    14  
    15  Note that the consumer / producer interact in a _different_ order with the `pendingWorkQueue` vs the `notifier`:
    16  * the producer first drops its work into the queue and subsequently sends the notification 
    17  * the consumer first processes elements from the queue and subsequently checks for a notification 
    18  Thereby, it is guaranteed that at least one consumer routine will be notified when work is added
    19