Documentation

Std.Sync.Semaphore

structure Std.Semaphore :

Counting semaphore.

Semaphore.acquire returns a promise that is resolved once a permit is available. If a permit is currently available, the returned promise is already resolved. Semaphore.release either resolves one waiting promise or increments the available permits.

Instances For

    Creates a new semaphore with permits initially available permits.

    Equations
    Instances For

      Requests one permit. Returns a promise that resolves once the permit is acquired.

      Equations
      • One or more equations did not get rendered due to their size.
      Instances For

        Tries to acquire a permit without blocking. Returns true on success.

        Equations
        • One or more equations did not get rendered due to their size.
        Instances For

          Releases one permit and resolves one waiting acquirer, if any.

          Equations
          • One or more equations did not get rendered due to their size.
          Instances For

            Returns the number of currently available permits.

            Equations
            Instances For