Lunchbox  1.8.0
Public Member Functions | List of all members
lunchbox::Lock Class Reference

A lock (mutex) primitive. More...

#include <lock.h>

+ Inheritance diagram for lunchbox::Lock:
+ Collaboration diagram for lunchbox::Lock:

Public Member Functions

 Lock ()
 Construct a new lock.
 ~Lock ()
 Destruct the lock.
void set ()
 Acquire the lock.
void unset ()
 Release the lock.
void setRead ()
 Acquire the lock shared with other readers.
void unsetRead ()
 Release a shared read lock.
bool trySet ()
 Attempt to acquire the lock.
bool isSet ()
 Test if the lock is set.

Detailed Description

A lock (mutex) primitive.

See Also
ScopedMutex

Definition at line 32 of file lock.h.

Constructor & Destructor Documentation

lunchbox::Lock::Lock ( )

Construct a new lock.

Version
1.0
lunchbox::Lock::~Lock ( )

Destruct the lock.

Version
1.0

Member Function Documentation

bool lunchbox::Lock::isSet ( )

Test if the lock is set.

Returns
true if the lock is set, false if it is not set.
Version
1.0
void lunchbox::Lock::set ( )

Acquire the lock.

Version
1.0
void lunchbox::Lock::setRead ( )
inline

Acquire the lock shared with other readers.

Version
1.3.2

Definition at line 48 of file lock.h.

bool lunchbox::Lock::trySet ( )

Attempt to acquire the lock.

This method implements an atomic test-and-set operation.

Returns
true if the lock was set, false if it was not set.
Version
1.0
void lunchbox::Lock::unset ( )

Release the lock.

Version
1.0

Referenced by unsetRead().

+ Here is the caller graph for this function:

void lunchbox::Lock::unsetRead ( )
inline

Release a shared read lock.

Version
1.3.2

Definition at line 51 of file lock.h.

References unset().

+ Here is the call graph for this function:


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