Documentation

Std.Sync.Notify

This module contains the implementation of Std.Notify. Std.Notify provides a lightweight notification primitive for signaling between tasks or threads. It supports both synchronous and asynchronous waiting, and is useful for cases where you want to notify one or more waiters that an event has occurred.

Unlike a channel, Std.Notify does not buffer messages or carry data. It's simply a trigger. If no one is waiting, notifications are lost. If one or more waiters are present, exactly one will be woken up per notification.

inductive Std.Notify.Consumer (α : Type) :
Instances For
    def Std.Notify.Consumer.resolve {α : Type} (c : Consumer α) (x : α) :
    Equations
      Instances For

        The central state structure for a Notify.

        Instances For
          structure Std.Notify :

          A notify is a synchronization primitive that allows multiple consumers to wait until notify is called.

          Instances For

            Create a new notify.

            Equations
              Instances For

                Notify all currently waiting consumers.

                Equations
                  Instances For

                    Notify exactly one waiting consumer (if any). Returns true if a consumer was notified, false if no consumers were waiting.

                    Equations
                      Instances For

                        Wait to be notified. Returns a task that completes when notify is called. Note: if notify was called before wait, this will wait for the next notify call.

                        Equations
                          Instances For

                            Creates a selector that waits for notifications

                            Equations
                              Instances For