core.sync.mutex
The mutex module provides a primitive for maintaining mutually exclusive access.
Copyright
Copyright Sean Kelly 2005 - 2009.
class Mutex
Types 1
classMutex : Object.Monitor
This class represents a general purpose, recursive mutex.
Implemented using pthread_mutex on Posix and CRITICAL_SECTION on Windows.
Fields
MonitorProxy m_proxyMethods
void lock() @trustedIf this lock is not already held by the caller, the lock is acquired, then the internal counter is incremented by one.void lock_nothrow(this Q)() if (is(Q == Mutex) || is(Q == shared Mutex)) nothrow @trusted @nogcdittovoid unlock() @trustedDecrements the internal lock count by one. If this brings the count to zero, the lock is released.void unlock_nothrow(this Q)() if (is(Q == Mutex) || is(Q == shared Mutex)) nothrow @trusted @nogcdittobool tryLock() @trustedIf 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.bool tryLock_nothrow(this Q)() if (is(Q == Mutex) || is(Q == shared Mutex)) nothrow @trusted @nogcdittoConstructors
this()Initializes a mutex object.this()dittothis(bool _unused_)this(Object obj)Initializes a mutex object and sets it as the monitor for `obj`.this(Object obj)dittothis(Object obj, bool _unused_)Destructors
Nested Templates
MonitorProxy