39 #ifndef BLOCXX_GENERIC_RWLOCK_IMPL_HPP_INCLUDE_GUARD_ 40 #define BLOCXX_GENERIC_RWLOCK_IMPL_HPP_INCLUDE_GUARD_ 41 #include "blocxx/BLOCXX_config.h" 63 template <
typename IdT,
typename CompareT>
111 return readCount > 0;
116 return writeCount > 0;
120 typedef std::map<IdT, LockerInfo, CompareT>
IdMap;
129 template <
typename IdT,
typename CompareT>
137 template <
typename IdT,
typename CompareT>
142 template <
typename IdT,
typename CompareT>
173 m_lockerInfo.insert(
typename IdMap::value_type(
id, lockerInfo));
179 template <
typename IdT,
typename CompareT>
187 if (pInfo ==
m_lockerInfo.end() || !pInfo->second.isReader())
209 template <
typename IdT,
typename CompareT>
302 m_lockerInfo.insert(
typename IdMap::value_type(
id, ti));
310 template <
typename IdT,
typename CompareT>
318 if (pInfo ==
m_lockerInfo.end() || !pInfo->second.isWriter())
void releaseWriteLock(const IdT id)
void acquireWriteLock(const IdT id, const Timeout &timeout)
void acquireReadLock(const IdT id, const Timeout &timeout)
Timeout asAbsoluteTimeout() const
Converts the timer to an absolute timeout.
A TimeoutTimer is used by an algorithm to determine when a timeout has expired.
std::map< IdT, LockerInfo, CompareT > IdMap
This class is the implementation of the read/write lock.
#define BLOCXX_ASSERT(CON)
BLOCXX_ASSERT works similar to the assert() macro, but instead of calling abort(), it throws an AssertionException.
NonRecursiveMutex m_guard
void notifyAll()
Signal all threads that are currently waiting on the Condition object.
GenericRWLockImpl & operator=(const GenericRWLockImpl &)
A timeout can be absolute, which means that it will happen at the specified DateTime.
Condition m_waiting_writers
bool timedWait(NonRecursiveMutexLock &lock, const Timeout &timeout)
Atomically unlock a given mutex and wait for a given amount of time for this Condition object to get ...
void releaseReadLock(const IdT id)
#define BLOCXX_THROW(exType, msg)
Throw an exception using FILE and LINE.
#define BLOCXX_DECLARE_APIEXCEPTION(NAME, LINKAGE_SPEC)
Declare a new exception class named <NAME>Exception that derives from Exception This macro is typical...
Note that descriptions of what exceptions may be thrown assumes that object is used correctly...
Note that descriptions of what exceptions may be thrown assumes that object is used correctly...
void notifyOne()
Signal one thread that is currently waiting on the Condition object through the wait or timedWait met...
Condition m_waiting_readers
The Condition class represents a synchronization device that allows threads to suspend execution and ...