core.sync.rwmutex
The read/write mutex module provides a primitive for maintaining shared read access and mutually exclusive write access.
Copyright
Types 1
This class represents a mutex that allows any number of readers to enter, but when a writer enters, all other readers and writers are blocked.
Please note that this mutex is not recursive and is intended to guard access to data only. Also, no deadlock checking is in place because doing so would require dynamic memory allocation, which would reduce performance by an unacceptable amount. As a result, any attempt to recursively acquire this mutex may well deadlock the caller, particularly if a write lock is acquired while holding a read lock, or vice-versa. In practice, this should not be an issue however, because it is uncommon to call deeply into unknown code while holding a lock that simply protects data.
Policy m_policyReader m_readerWriter m_writerMutex m_commonMutexCondition m_readerQueueCondition m_writerQueueint m_numQueuedReadersint m_numActiveReadersint m_numQueuedWritersint m_numActiveWritersReader reader() @property @safe nothrowGets an object representing the reader lock for the associated mutex.Writer writer() @property @safe nothrowGets an object representing the writer lock for the associated mutex.this( Policy policy = Policy.PREFER_WRITERS )Initializes a read/write mutex object with the supplied policy.this( Policy policy = Policy.PREFER_WRITERS )dittoPolicyDefines the policy used by this mutex. Currently, two policies are defined.ReaderThis class can be considered a mutex in its own right, and is used to negotiate a read lock for the enclosing mutex.WriterThis class can be considered a mutex in its own right, and is used to negotiate a write lock for the enclosing mutex.