Counting semaphores are available as an alternative primitive for managing threads within device drivers. See the semaphore(9F) man page for more information. The semaphore functions are:
Destroys a semaphore.
Initialize a semaphore.
Decrement semaphore and possibly block.
Decrement semaphore but do not block if signal is pending. See Threads Unable to Receive Signals.
Attempt to decrement semaphore, but do not block.
Increment semaphore and possibly unblock waiter.