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.8 date: 2018/11/01 19:26:31
user: stefan
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 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.2.0.0; WebServer 1.670 at bd0aa1f87cdd.unknown:8081; Fri, 29 Mar 2024 07:12:47 GMT