TutRwMutexReadLock read-lock a R/W mutex
rw_mutex
R/W mutex object to lock
TRUE
if lock was granted, FALSE
otherwise.
If TutRwMutexReadLock fails, it returns FALSE
and sets the global SmartSockets error number to one of:
TutRwMutexReadLock read-locks a R/W mutex. A read-lock implies that the thread may safely examine (but not modify) the state of the resource protected by the R/W mutex. Read-locks may be held simultaneously by more than one thread.
Like normal mutexes, R/W mutexes can be recursively locked. A thread is never suspended by a recursive lock operation. This means that a thread already granted a read-lock always succeeds immediately in obtaining another read-lock, and a thread already granted a write-lock succeeds immediately in obtaining either a read-lock or a write-lock. A single thread holding multiple read-locks is still only a single reader-thread so far as the quota is concerned.
Every call to TutRwMutexReadLock should be balanced by a subsequent call to TutRwMutexUnlock.
TutRwMutexCreate, TutRwMutexUnlock, TutRwMutexWriteLock
This example read-locks a R/W mutex:
TIBCO SmartSockets™ Utilities Software Release 6.8, July 2006 Copyright © TIBCO Software Inc. All rights reserved www.tibco.com |