a handle to a MLib read/write lock object. see
M_RWLockRec
A read/write lock is similar to a mutex, but is
used to protect shared data that is frequently
read, and seldom updated or written to.
A thread that only needs to read some protected
data will call
m_rwlock_read_begin
, perform the read, then call
m_rwlock_read_end
.
A thread that wants to write to the same data
will call
m_rwlock_write_begin
, perform the write, then call
m_rwlock_write_end
Finally, a thread that wants to read the data and
_eventually_ write to it will call
m_rwlock_update_begin
, perform the read and determine if the data will
need an update.
If so, it will call
m_rwlock_update_write
, perform the write, then call
m_rwlock_update_end
. If not, it will call
m_rwlock_update_end
.
the implementation of a read/write lock on most
platforms provide very fast implementation for
"read_begin" and "read_end" (usually by avoiding
any kernel call).
read/write locks also allow several concurrent
reads on the protected data, as long as no thread
called
m_rwlock_write_begin
or
m_rwlock_update_write
|