bt-semaphore

API Reference

bt-semaphore

A simple semaphore class for bordeaux-threads inspired by SBCL's semaphore.

BT-SEMAPHORE

  • Method SIGNAL-SEMAPHORE ((instance semaphore) &optional (n 1))
    Increment the count of the semaphore instance by n. If there are threads waiting on this semaphore, then n of them are woken up.
  • Method WAIT-ON-SEMAPHORE ((instance semaphore) &key timeout)
    Decrement the count of the semaphore instance if the count would not be negative, else block until the semaphore can be decremented. Returns t on success. If timeout is given, it is the maximum number of seconds to wait. If the count cannot be decremented in that time, return nil.
  • Method TRY-SEMAPHORE ((instance semaphore) &optional (n 1))
    Try to decrement the count of semaphore by n. Returns nil if the count were to become negative, otherwise returns t.
  • Method SEMAPHORE-COUNT ((instance semaphore))
    Return the count of the semaphore.
  • Method SEMAPHORE-WAITERS ((instance semaphore))
    Return the number of threads waiting on the semaphore.
  • Function MAKE-SEMAPHORE (&key name (count 0))
    Create a semaphore with the supplied name and count.