QWriteLocker Class Reference

QWriteLocker Class Reference

#include <qreadwritelock.h>

Class Description

Definition at line 133 of file qreadwritelock.h.

Public Member Functions

 QWriteLocker (QReadWriteLock *readWriteLock)
 
 ~QWriteLocker ()
 
void unlock ()
 
void relock ()
 
QReadWriteLockreadWriteLock () const
 

Constructor & Destructor Documentation

QWriteLocker ( QReadWriteLock readWriteLock)
inline

Definition at line 170 of file qreadwritelock.h.

171  : q_val(reinterpret_cast<quintptr>(areadWriteLock))
172 {
173  Q_ASSERT_X((q_val & quintptr(1u)) == quintptr(0),
174  "QWriteLocker", "QReadWriteLock pointer is misaligned");
175  relock();
176 }
~QWriteLocker ( )
inline

Definition at line 138 of file qreadwritelock.h.

139  { unlock(); }

Member Function Documentation

void unlock ( )
inline

Definition at line 141 of file qreadwritelock.h.

142  {
143  if (q_val) {
144  if ((q_val & quintptr(1u)) == quintptr(1u)) {
145  q_val &= ~quintptr(1u);
146  readWriteLock()->unlock();
147  }
148  }
149  }
QReadWriteLock * readWriteLock() const
void relock ( )
inline

Definition at line 151 of file qreadwritelock.h.

152  {
153  if (q_val) {
154  if ((q_val & quintptr(1u)) == quintptr(0u)) {
156  q_val |= quintptr(1u);
157  }
158  }
159  }
QReadWriteLock * readWriteLock() const
void lockForWrite()
QReadWriteLock* readWriteLock ( ) const
inline

Definition at line 161 of file qreadwritelock.h.

162  { return reinterpret_cast<QReadWriteLock *>(q_val & ~quintptr(1u)); }

The documentation for this class was generated from the following file: