QtCore/qreadwritelock.h Source File
Go to the documentation of this file.
42 #ifndef QREADWRITELOCK_H
43 #define QREADWRITELOCK_H
56 struct QReadWriteLockPrivate;
68 bool tryLockForRead();
69 bool tryLockForRead(
int timeout);
72 bool tryLockForWrite();
73 bool tryLockForWrite(
int timeout);
79 QReadWriteLockPrivate *d;
84 #if defined(Q_CC_MSVC)
85 #pragma warning( push )
86 #pragma warning( disable : 4312 ) // ignoring the warning from /Wp64
100 if ((q_val & quintptr(1u)) == quintptr(1u)) {
101 q_val &= ~quintptr(1u);
102 readWriteLock()->
unlock();
110 if ((q_val & quintptr(1u)) == quintptr(0u)) {
112 q_val |= quintptr(1u);
118 {
return reinterpret_cast<QReadWriteLock *
>(q_val & ~quintptr(1u)); }
126 : q_val(reinterpret_cast<quintptr>(areadWriteLock))
128 Q_ASSERT_X((q_val & quintptr(1u)) == quintptr(0),
129 "QReadLocker",
"QReadWriteLock pointer is misaligned");
144 if ((q_val & quintptr(1u)) == quintptr(1u)) {
145 q_val &= ~quintptr(1u);
146 readWriteLock()->
unlock();
154 if ((q_val & quintptr(1u)) == quintptr(0u)) {
156 q_val |= quintptr(1u);
162 {
return reinterpret_cast<QReadWriteLock *
>(q_val & ~quintptr(1u)); }
171 : q_val(reinterpret_cast<quintptr>(areadWriteLock))
173 Q_ASSERT_X((q_val & quintptr(1u)) == quintptr(0),
174 "QWriteLocker",
"QReadWriteLock pointer is misaligned");
178 #if defined(Q_CC_MSVC)
179 #pragma warning( pop )
182 #else // QT_NO_THREAD
187 enum RecursionMode { NonRecursive, Recursive };
191 static inline void lockForRead() { }
192 static inline bool tryLockForRead() {
return true; }
193 static inline bool tryLockForRead(
int timeout) { Q_UNUSED(timeout);
return true; }
195 static inline void lockForWrite() { }
196 static inline bool tryLockForWrite() {
return true; }
197 static inline bool tryLockForWrite(
int timeout) { Q_UNUSED(timeout);
return true; }
199 static inline void unlock() { }
211 static inline void unlock() { }
212 static inline void relock() { }
225 static inline void unlock() { }
226 static inline void relock() { }
233 #endif // QT_NO_THREAD
239 #endif // QREADWRITELOCK_H
QReadWriteLock * readWriteLock() const
#define QT_BEGIN_NAMESPACE
QReadWriteLock * readWriteLock() const