Next: , Previous: , Up: Semaphore   [Index]


1.150.3 Semaphore: builtins

lock

Without putting the receiver to sleep, force processes that try to wait on the semaphore to block. Answer whether this was the case even before.

notify

Resume one of the processes that were waiting on the semaphore if there were any. Do not leave a signal on the semaphore if no process is waiting.

notifyAll

Resume all the processes that were waiting on the semaphore if there were any. Do not leave a signal on the semaphore if no process is waiting.

signal

Signal the receiver, resuming a waiting process’ if there is one

wait

Wait for the receiver to be signalled, suspending the executing process if it is not yet. Return nil if the wait was interrupted, the receiver otherwise.

waitAfterSignalling: aSemaphore

Signal aSemaphore then, atomically, wait for the receiver to be signalled, suspending the executing process if it is not yet. This is needed to avoid race conditions when the #notify and #notifyAll are used before waiting on receiver: otherwise, if a process sends any of the two between the time aSemaphore is signaled and the time the process starts waiting on the receiver, the notification is lost.