Squeak Class Documentation category index | class index  
 
Semaphore
  category: Kernel-Processes
  superclass: LinkedList
  subclasses:

I provide synchronized communication of a single bit of information (a "signal") between Processes. A signal is sent by sending the message signal and received by sending the message wait. If no signal has been sent when a wait message is sent, the sending Process will be suspended until a signal is sent.

instance methods
  communication
  signal
wait
waitTimeoutMSecs:
waitTimeoutSeconds:

  comparing
  =
hash

  initialize-release
  initSignals
terminateProcess

  mutual exclusion
  critical:
critical:ifError:

  testing
  isSignaled

class methods
  instance creation
  forMutualExclusion
new

instance methods
  communication top  
 

signal

Primitive. Send a signal through the receiver. If one or more processes
have been suspended trying to receive a signal, allow the first one to
proceed. If no process is waiting, remember the excess signal. Essential.
See Object documentation whatIsAPrimitive.


 

wait

Primitive. The active Process must receive a signal through the receiver
before proceeding. If no signal has been sent, the active Process will be
suspended until one is sent. Essential. See Object documentation
whatIsAPrimitive.


 

waitTimeoutMSecs:

Wait on this semaphore for up to the given number of milliseconds, then timeout. It is up to the sender to determine the difference between the expected event and a timeout.


 

waitTimeoutSeconds:

Wait on this semaphore for up to the given number of seconds, then timeout. It is up to the sender to determine the difference between the expected event and a timeout.


  comparing top  
 

=

Answer true if the receiver is equivalent to the otherCollection.
First test for identity, then rule out different species and sizes of
collections. As a last resort, examine each element of the receiver
and the otherCollection.


 

hash

Answer an integer hash value for the receiver such that,
-- the hash value of an unchanged object is constant over time, and
-- two equal objects have equal hash values


  initialize-release top  
 

initSignals

Consume any excess signals the receiver may have accumulated.


 

terminateProcess

Terminate the process waiting on this semaphore, if any.


  mutual exclusion top  
 

critical:

Evaluate mutuallyExcludedBlock only if the receiver is not currently in
the process of running the critical: message. If the receiver is, evaluate
mutuallyExcludedBlock after the other critical: message is finished.


 

critical:ifError:

Evaluate mutuallyExcludedBlock only if the receiver is not currently in
the process of running the critical: message. If the receiver is, evaluate
mutuallyExcludedBlock after the other critical: message is finished.


  testing top  
 

isSignaled

Return true if this semaphore is currently signaled


class methods
  instance creation top  
 

forMutualExclusion

Answer an instance of me that contains a single signal. This new
instance can now be used for mutual exclusion (see the critical: message
to Semaphore).


 

new

Answer a new instance of Semaphore that contains no signals.