eXept Software AG Logo

Smalltalk/X Webserver

Documentation of class 'EventSemaphore':

Home

Documentation
www.exept.de
Everywhere
for:
[back]

Class: EventSemaphore


Inheritance:

   Object
   |
   +--Semaphore
      |
      +--EventSemaphore

Package:
stx:libbasic
Category:
Kernel-Processes
Version:
rev: 1.6 date: 2018/02/22 16:07:47
user: cg
file: EventSemaphore.st directory: libbasic
module: stx stc-classLibrary: libbasic
Author:
Stefan Vogel

Description:


Processes wait for an EventSemaphores until it is signaled.
The EventSemaphore is not consumed and remains signaled until manually reset.


Related information:

    Semaphore

Class protocol:

signaling
o  new: n
count must be 0 or 1


Instance protocol:

blocked
o  signalForAll
blocked, since it would only set the event if there was anyone waiting

o  signalIf
blocked, since it would only set the event if there was anyone waiting

misc
o  reset
reset the event to the non-signaled state

semaphoreSet interface
o  checkAndAddWaitingProcess: process
interface for SemaphoreSet.
If the semaphore is available, return true.
Otherwise register our process to be wakened up once the semaphore is available
and return false.
ATTENTION: this must be invoked with OperatingSystem-interrupts-blocked.

signaling
o  signal
redefined to limit count to 1

waiting
o  wait
once signaled, do not decrement the count

o  waitWithTimeoutMs: milliSeconds
wait for the semaphore, but abort the wait after some time.
return the receiver if the semaphore triggered normal, nil if we return
due to a timeout.
With zero timeout, this can be used to poll a semaphore (returning
the receiver if the semaphore is available, nil if not).
However, polling is not the intended use of semaphores, though.
If milliSeconds is nil, wait without timeout.

Redefined: once signaled, do not decrement the count

o  waitWithTimeoutMs: milliSeconds state: newState
wait for the semaphore, but abort the wait after some time.
return the receiver if the semaphore triggered normal, nil if we return
due to a timeout.
With zero timeout, this can be used to poll a semaphore (returning
the receiver if the semaphore is available, nil if not).
However, polling is not the intended use of semaphores, though.
If milliSeconds is nil, wait without timeout.

Redefined: once signaled, do not decrement the count



ST/X 7.1.0.0; WebServer 1.663 at exept.de:8081; Mon, 19 Nov 2018 21:44:13 GMT