All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
QoreThreadLock Class Reference

provides a mutually-exclusive thread lock More...

`#include <QoreThreadLock.h>`

## Public Member Functions

DLLLOCAL | QoreThreadLock ()
| creates the lock
DLLLOCAL | QoreThreadLock (const pthread_mutexattr_t *ma)
| creates the lock with the given attributes
DLLLOCAL | ~QoreThreadLock ()
| destroys the lock
DLLLOCAL | QoreThreadLock (const QoreThreadLock &)
| creates a new object (not based on the original lock status)
DLLLOCAL void | lock ()
| grabs the lock (assumes that the lock is unlocked)
DLLLOCAL void | unlock ()
| releases the lock (assumes that the lock is locked)
DLLLOCAL int | trylock ()
| attempts to acquire the mutex and returns the status immediately; does not block

## Friends

class | QoreCondition

## Detailed Description

provides a mutually-exclusive thread lock

This class is just a simple wrapper for pthread_mutex_t. It does not provide any special logic for checking for correct usage, etc.

## Member Function Documentation

DLLLOCAL void QoreThreadLock::lock | ( |  | ) |

inline

grabs the lock (assumes that the lock is unlocked)

no error checking happens here; if you grab the lock twice it will deadlock

Referenced by AutoLocker::AutoLocker(), SafeLocker::lock(), OptLocker::OptLocker(), and SafeLocker::SafeLocker().

DLLLOCAL int QoreThreadLock::trylock | ( |  | ) |

inline

attempts to acquire the mutex and returns the status immediately; does not block

Returns
  0 if the lock was acquired, a non-zero error number if the lock was not acquired

DLLLOCAL void QoreThreadLock::unlock | ( |  | ) |

inline

releases the lock (assumes that the lock is locked)

no error checking is implemented here

Referenced by SafeLocker::unlock(), AutoLocker::~AutoLocker(), OptLocker::~OptLocker(), and SafeLocker::~SafeLocker().

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

- include/qore/QoreThreadLock.h (5431)