OpenZWave::Mutex Class Reference

Implements a platform-independent mutex–for serializing access to a shared resource. More...

`#include <Mutex.h>`

Inheritance diagram for OpenZWave::Mutex:

## Public Member Functions

| Mutex ()
bool | Lock (bool const _bWait=true)
void | Unlock ()
virtual bool | IsSignalled ()
Public Member Functions inherited from OpenZWave::Wait
void | AddWatcher (pfnWaitNotification_t _callback, void *_context)
void | RemoveWatcher (pfnWaitNotification_t _callback, void *_context)
Public Member Functions inherited from OpenZWave::Ref
| Ref ()
void | AddRef ()
int32 | Release ()

## Protected Member Functions

| ~Mutex ()
Protected Member Functions inherited from OpenZWave::Wait
| Wait ()
virtual | ~Wait ()
void | Notify ()
Protected Member Functions inherited from OpenZWave::Ref
virtual | ~Ref ()

## Additional Inherited Members

Public Types inherited from OpenZWave::Wait
enum | { Timeout_Immediate = 0, Timeout_Infinite = -1 }
typedef void(* | pfnWaitNotification_t) (void *_context)
Static Public Member Functions inherited from OpenZWave::Wait
static int32 | Single (Wait *_object, int32 _timeout=-1)
static int32 | Multiple (Wait **_objects, uint32 _numObjects, int32 _timeout=-1)

## Detailed Description

Implements a platform-independent mutex–for serializing access to a shared resource.

## Constructor & Destructor Documentation

## Mutex()

Mutex::Mutex | ( |  | ) |

Constructor. Creates a mutex object that can be used to serialize access to a shared resource.

## ~Mutex()

Mutex::~Mutex | ( |  | ) |

protected

Destructor. Destroys the mutex object.

## Member Function Documentation

## IsSignalled()

bool Mutex::IsSignalled | ( |  | ) |

virtual

Used by the Wait class to test whether the mutex is free.

Implements OpenZWave::Wait.

## Lock()

bool Mutex::Lock | ( | bool const | _bWait = `true` | ) |

Lock the mutex. Attempts to lock the mutex. There must be a matching call to Release for every call to Lock.

Parameters

  _bWait | Defaults to true. Set this argument to false if the method should return immediately, even if the lock is not available.

Returns
  True if the lock was obtained.

See also
  Unlock

## Unlock()

void Mutex::Unlock | ( |  | ) |

Releases the lock on the mutex. There must be a matching call to Release for every call to Lock.

See also
  Lock

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

- Mutex.h
- Mutex.cpp