package semaphore
- Alphabetic
- Public
- All
Type Members
-
class
BooleanSemaphore
extends Semaphore
A fast boolean semaphore implemented with a nonblocking queue.
A fast boolean semaphore implemented with a nonblocking queue.
The object
parent
(by default the semaphore itself) is used by the debugger when reporting the state of waiting processes.The object
parent
is shown by the debugger when doing stack backtraces.The value
spin
is the number of attempts the semaphore's inbuilt spinlock will make to seize the semaphore before a call toacquire
oracquireFast
causes the caller to be descheduled. The point of trying with a spinlock first is that the performance-hit of descheduling can be very high. We assume here that more than one processor is available: setspin
to0
or1
otherwise.The
fair
parameter is ignored.- To do
Make the internal spinlock adaptive
-
class
CountingSemaphore
extends Semaphore
A counting semaphore implemented with a nonblocking queue.
A counting semaphore implemented with a nonblocking queue. In principle the semaphore manages a finite collection of (identical) tokens.
The object
parent
(by default the semaphore itself) is used by the debugger when reporting the state of waiting processes.The value of
available
may be negative, in which case it represents a deficit of tokens.The value
spin
is the number of attempts the semaphore's local spinlock will make to acquire a token before a call toacquire
oracquireFast
causes the caller to be descheduled. The point of trying with a spinlock first is that the performance-hit of descheduling can be very high. We assume here that more than one processor is available: setspin
to0
or1
otherwise.The
fair
parameter is ignored.- To do
Make the internal spinlock adaptive
-
class
FastFlag
extends Semaphore
A high-performance variant of
Flag
with no intrinsic support for debugging or dynamic error-checking.A high-performance variant of
Flag
with no intrinsic support for debugging or dynamic error-checking. A synchronization object that supports a single thread waiting until some other thread enables it to proceed. Functionally equivalent to (but considerably more efficient than) aBooleanSemaphore(false)
that can berelease
d once. -
class
Flag
extends Semaphore
A synchronization object that supports a single thread waiting until some other thread enables it to proceed.
A synchronization object that supports a single thread waiting until some other thread enables it to proceed. Functionally equivalent to (but considerably more efficient than) a
BooleanSemaphore(false)
that can berelease
d once. -
class
Latch
extends AnyRef
A synchronization object that supports threads waiting until a fixed number of operations being performed in other threads have been completed.
A synchronization object that supports threads waiting until a fixed number of operations being performed in other threads have been completed.
A
Latch
is initialized with a given count. Theawait
methods block until the current count reaches zero throughdecrement
invocations, after which all waiting threads are allowed to proceed and any subsequent invocations ofawait
return immediately. This happens exactly once per latch: its count cannot be reset.If the latch is strict then any
decrement
calls subsequent to the one that makes the count zero will raise anIllegalStateException
. -
trait
Semaphore
extends AnyRef
Trait inherited by all semaphore implementations.
Trait inherited by all semaphore implementations. All semaphores have available a virtual finite collection of tokens that their clients may acquire and release.
Value Members
-
object
BooleanSemaphore
extends NameGenerator
Semaphore factory.
-
object
CountingSemaphore
extends NameGenerator
Factory for Counting semaphores
- object Flag extends NameGenerator
- object Latch extends NameGenerator