|
Class: EventSemaphore
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
Processes wait for an EventSemaphores until it is signaled.
The EventSemaphore is not consumed and remains signaled until manually reset.
Semaphore
signaling
-
new: n
-
count must be 0 or 1
blocked
-
signalForAll
-
blocked, since it would only set the event if there was anyone waiting
-
signalIf
-
blocked, since it would only set the event if there was anyone waiting
misc
-
reset
-
reset the event to the non-signaled state
semaphoreSet interface
-
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
-
signal
-
redefined to limit count to 1
waiting
-
wait
-
once signaled, do not decrement the count
-
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
|