23 #ifndef __ccxx_ScopedReadWriteLock_hxx 24 #define __ccxx_ScopedReadWriteLock_hxx 59 : _rwlock(rwlock), _once(false)
71 inline bool testOnce()
72 {
bool f = _once; _once =
false;
return(f); }
111 : _rwlock(rwlock), _once(true)
123 inline bool testOnce()
124 {
bool f = _once; _once =
false;
return(f); }
141 #if (defined CCXX_OS_WINDOWS) && (defined _MSC_VER) && (_MSC_VER < 1400) 143 #define synchronized_read(LOCK) \ 144 for(commoncpp::ScopedReadLock LOCK ## _locker(LOCK); \ 145 LOCK ## _locker.testOnce();) 149 #define synchronized_read(LOCK) \ 150 for(commoncpp::ScopedReadLock \ 151 CCXX_OS_UNIQUE_VARNAME(LOCK, __LINE__, locker)(LOCK); \ 152 CCXX_OS_UNIQUE_VARNAME(LOCK, __LINE__, locker).testOnce();) 160 #if (defined CCXX_OS_WINDOWS) && (defined _MSC_VER) && (_MSC_VER < 1400) 162 #define synchronized_write(LOCK) \ 163 for(commoncpp::ScopedWriteLock LOCK ## _locker(LOCK); \ 164 LOCK ## _locker.testOnce();) 168 #define synchronized_write(LOCK) \ 169 for(commoncpp::ScopedWriteLock \ 170 CCXX_OS_UNIQUE_VARNAME(LOCK, __LINE__, locker)(LOCK); \ 171 CCXX_OS_UNIQUE_VARNAME(LOCK, __LINE__, locker).testOnce();) 175 #endif // __ccxx_ScopedReadWriteLock_hxx
ScopedReadLock(ReadWriteLock &rwlock)
Construct a new ScopedReadLock for the given ReadWriteLock.
Definition: ScopedReadWriteLock.h++:58
void unlock()
Release the lock.
Definition: ReadWriteLock.c++:226
ScopedWriteLock(ReadWriteLock &rwlock)
Construct a new ScopedWriteLock for the given ReadWriteLock.
Definition: ScopedReadWriteLock.h++:110
~ScopedReadLock()
Destructor.
Definition: ScopedReadWriteLock.h++:65
A Read/Write lock – a synchronization primitive that allows multiple threads to coordinate access to...
Definition: ReadWriteLock.h++:50
A convenience object for lexical scope based synchronization.
Definition: ScopedReadWriteLock.h++:50
void lockRead()
Acquire a read lock, blocking until the lock is acquired.
Definition: ReadWriteLock.c++:67
A convenience object for lexical scope based synchronization.
Definition: ScopedReadWriteLock.h++:102
#define CCXX_COPY_DECLS(CLASS)
Inlines declarations of a copy constructor and assignment operator for the class CLASS.
Definition: Common.h++:295
Definition: AllocationMap.c++:25
~ScopedWriteLock()
Destructor.
Definition: ScopedReadWriteLock.h++:117