- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files
- Directories
- Examples

- Class List
- Class Hierarchy
- Class Members

Public Member Functions

# QMutexLocker Class Reference

Search for all occurrences

## Detailed Description

Definition at line 94 of file qmutex.h.

`#include <qmutex.h>`

List of all members.

## Public Member Functions
| QMutexLocker (QMutex *m)
| ~QMutexLocker ()
void | unlock ()
void | relock ()
QMutex * | mutex () const

## Constructor & Destructor Documentation

QMutexLocker | ( | QMutex * | m | ) | `[inline, explicit]`

Definition at line 97 of file qmutex.h.

        {
            Q_ASSERT_X((reinterpret_cast<quintptr>(m) & quintptr(1u)) == quintptr(0),
                       "QMutexLocker", "QMutex pointer is misaligned");
            if (m) {
                m->lock();
                val = reinterpret_cast<quintptr>(m) | quintptr(1u);
            } else {
                val = 0;
            }
        }

~QMutexLocker | ( |  | ) | `[inline]`

Definition at line 108 of file qmutex.h.

    { unlock(); }

## Member Function Documentation

void unlock | ( |  | ) | `[inline]`

Search for all occurrences

Definition at line 110 of file qmutex.h.

        {
            if ((val & quintptr(1u)) == quintptr(1u)) {
                val &= ~quintptr(1u);
                mutex()->unlock();
            }
        }

void relock | ( |  | ) | `[inline]`

Search for all occurrences

Definition at line 118 of file qmutex.h.

        {
            if (val) {
                if ((val & quintptr(1u)) == quintptr(0u)) {
                    mutex()->lock();
                    val |= quintptr(1u);
                }
            }
        }

QMutex* mutex | ( |  | ) | const `[inline]`

Search for all occurrences

Definition at line 133 of file qmutex.h.

        {
            return reinterpret_cast<QMutex *>(val & ~quintptr(1u));
        }

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

- QtCore/qmutex.h

QMutexLocker QMutexLocker QMutexLocker QMutexLocker QMutexLocker QMutexLocker QMutexLocker QMutexLocker QMutexLocker QMutexLocker
QMutexLocker QMutexLocker QMutexLocker QMutexLocker QMutexLocker QMutexLocker QMutexLocker QMutexLocker QMutexLocker QMutexLocker