Next: , Previous: Mutex Support, Up: Threading


12.4 Semaphores

described here should be considered experimental, subject to API changes without notice.

— Structure: sb-thread:semaphore

Class precedence list: semaphore, structure-object, t

Semaphore type. The fact that a semaphore is a structure-object should be considered an implementation detail, and may change in the future.

— Function: sb-thread:make-semaphore &key name count

Create a semaphore with the supplied count and name.

— Function: sb-thread:semaphore-count instance

Returns the current count of the semaphore instance.

— Function: sb-thread:semaphore-name instance

Name of a queue. Can be assingned to using setf. Queue names can be arbitrary printable objects, and need not be unique.

— Function: sb-thread:signal-semaphore semaphore &optional n

Increment the count of semaphore by n. If there are threads waiting on this semaphore, then n of them is woken up.

— Function: sb-thread:wait-on-semaphore semaphore

Decrement the count of semaphore if the count would not be negative. Else blocks until the semaphore can be decremented.