semaphoreΒΆ
type semaphore
A semaphore for synchronizing concurrent code.
fun semaphore(Initial?: integer): semaphore
Returns a new semaphore with initial value
Initial
or1
if no initial value is specified.meth (Semaphore: semaphore):signal: integer
Increments the internal value in
Semaphore
, resuming any waiters. Returns the new value.meth (Semaphore: semaphore):value: integer
Returns the internal value in
Semaphore
.meth (Semaphore: semaphore):wait: integer
Waits until the internal value in
Semaphore
is postive, then decrements it and returns the new value.