The mutex module provides a primitive for maintaining mutually exclusive
access.
Sean Kelly
- class Mutex : Object.Monitor ¶
-
This class represents a general purpose, recursive mutex.
- this() ¶
-
Initializes a mutex object.
SyncException on error.
- this(Object o) ¶
-
Initializes a mutex object and sets it as the monitor for o.
o must not already have a monitor.
- void lock() ¶
-
If this lock is not already held by the caller, the lock is acquired,
then the internal counter is incremented by one.
SyncException on error.
- void unlock() ¶
-
Decrements the internal lock count by one. If this brings the count to
zero, the lock is released.
SyncException on error.
- bool tryLock() ¶
-
If the lock is held by another caller, the method returns. Otherwise,
the lock is acquired if it is not already held, and then the internal
counter is incremented by one.
true if the lock was acquired and false if not.
SyncException on error.