scoped_lock Class Reference

Simple scoped mutex lock. More...

#include <scoped_lock.h>

List of all members.

Public Member Functions

 scoped_lock (pthread_mutex_t *m)
 ~scoped_lock ()
void wait (pthread_cond_t *cond)

Private Member Functions

 scoped_lock (const scoped_lock &copy)
scoped_lockoperator= (const scoped_lock &rhs)

Private Attributes

pthread_mutex_t * mutex


Detailed Description

Simple scoped mutex lock.

This simple wrapper around the pthread implementation will unlock the mutex when the scoped_lock variable goes out of scope.

Definition at line 15 of file scoped_lock.h.


Constructor & Destructor Documentation

scoped_lock::scoped_lock ( pthread_mutex_t *  m  )  [inline]

Construct a scoped lock given a pthread mutex.

Parameters:
m the mutex to be locked for the duration of instance.

Definition at line 24 of file scoped_lock.h.

References mutex.

scoped_lock::~scoped_lock (  )  [inline]

Unlock the pthread mutex on scoped lock destruction.

Definition at line 31 of file scoped_lock.h.

References mutex.

scoped_lock::scoped_lock ( const scoped_lock copy  )  [private]


Member Function Documentation

void scoped_lock::wait ( pthread_cond_t *  cond  )  [inline]

Wait on the pthread mutex given the specified condition variable.

Parameters:
cond condition variable on whose signal to wait

Definition at line 39 of file scoped_lock.h.

References mutex.

Referenced by shm_queue< T >::pop().

scoped_lock& scoped_lock::operator= ( const scoped_lock rhs  )  [private]


Member Data Documentation

pthread_mutex_t* scoped_lock::mutex [private]

Definition at line 47 of file scoped_lock.h.

Referenced by scoped_lock(), wait(), and ~scoped_lock().


The documentation for this class was generated from the following file:
Project shmq hosted by   SourceForge.net
Documentation generated on Sat Sep 2 10:07:40 2006 for shmq by   doxygen.org 1.4.6