My instances represent counting semaphores. I provide methods for signalling
the semaphore's availability, and methods for waiting for its availability.
I also provide some methods for implementing critical sections.
Answer a new semaphore with a signal on it. These semaphores are a useful
shortcut when you use semaphores as critical sections.
new
Answer a new semaphore
1.148.2 Semaphore: accessing
name
Answer a user-friendly name for the receiver
name: aString
Answer a user-friendly name for the receiver
waitingProcesses
Answer an Array of processes currently waiting on the receiver.
wouldBlock
Answer whether waiting on the receiver would suspend the current process.
1.148.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
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.
1.148.4 Semaphore: mutual exclusion
critical: aBlock
Wait for the receiver to be free, execute aBlock and signal the receiver
again. Return the result of evaluating aBlock.
1.148.5 Semaphore: printing
printOn: aStream
Print a human-readable represention of the receiver on aStream.
This document was generated
on August, 19 2010
using texi2html