CPPMyth
Library to interoperate with MythTV server
Myth::LockGuard Class Reference

#include <mythlocked.h>

Collaboration diagram for Myth::LockGuard:

Data Structures

struct  Lockable
 

Public Member Functions

 LockGuard (Lockable *lock)
 

Static Public Member Functions

static LockableCreateLock ()
 
static void DestroyLock (Lockable *lock)
 
static void Lock (Lockable *lock)
 
static void Unlock (Lockable *lock)
 
static void ClearLock (Lockable *lock)
 

Private Attributes

Lockablem_lock
 

Detailed Description

This implements a "guard" pattern

Definition at line 30 of file mythlocked.h.

Constructor & Destructor Documentation

◆ LockGuard()

LockGuard::LockGuard ( Lockable lock)

Initialize a guard which hold the lock. The lock will be released by the destructor.

Parameters
lockThe pointer to lockable object

Definition at line 35 of file mythlocked.cpp.

Member Function Documentation

◆ ClearLock()

void LockGuard::ClearLock ( Lockable lock)
static

Return once recursive count has been cleared and the lock is released.

Parameters
lock

Definition at line 66 of file mythlocked.cpp.

◆ CreateLock()

LockGuard::Lockable * LockGuard::CreateLock ( )
static

Create a new lockable object. The allocated resource must be freed by calling DestroyLock.

Returns
The pointer to the new lockable object

Definition at line 46 of file mythlocked.cpp.

◆ DestroyLock()

void LockGuard::DestroyLock ( Lockable lock)
static

Destroy lockable object previously allocated with CreateLock.

Parameters
lockThe pointer to lockable object

Definition at line 51 of file mythlocked.cpp.

◆ Lock()

void LockGuard::Lock ( Lockable lock)
static

Return once the lock is held and recursive count has been incremented.

Parameters
lockThe pointer to lockable object

Definition at line 56 of file mythlocked.cpp.

◆ Unlock()

void LockGuard::Unlock ( Lockable lock)
static

Return once the lock is released or recursive count has been decremented.

Parameters
lockThe pointer to lockable object

Definition at line 61 of file mythlocked.cpp.


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