LSSTApplications  1.1.2+25,10.0+13,10.0+132,10.0+133,10.0+224,10.0+41,10.0+8,10.0-1-g0f53050+14,10.0-1-g4b7b172+19,10.0-1-g61a5bae+98,10.0-1-g7408a83+3,10.0-1-gc1e0f5a+19,10.0-1-gdb4482e+14,10.0-11-g3947115+2,10.0-12-g8719d8b+2,10.0-15-ga3f480f+1,10.0-2-g4f67435,10.0-2-gcb4bc6c+26,10.0-28-gf7f57a9+1,10.0-3-g1bbe32c+14,10.0-3-g5b46d21,10.0-4-g027f45f+5,10.0-4-g86f66b5+2,10.0-4-gc4fccf3+24,10.0-40-g4349866+2,10.0-5-g766159b,10.0-5-gca2295e+25,10.0-6-g462a451+1
LSSTDataManagementBasePackage
Public Member Functions | Private Member Functions | Private Attributes | Friends | List of all members
lsst::ap::Mutex Class Reference

A wrapper for a process private POSIX mutual exclusion lock. More...

#include <Mutex.h>

Inheritance diagram for lsst::ap::Mutex:

Public Member Functions

 Mutex ()
 
 ~Mutex ()
 

Private Member Functions

void acquire ()
 
bool tryAcquire ()
 
void release ()
 

Private Attributes

::pthread_mutex_t _mutex
 

Friends

class ScopedLock< Mutex >
 
class Condition< Mutex >
 

Detailed Description

A wrapper for a process private POSIX mutual exclusion lock.

Definition at line 56 of file Mutex.h.

Constructor & Destructor Documentation

lsst::ap::Mutex::Mutex ( )
inline

Definition at line 60 of file Mutex.h.

60  {
61  int err = ::pthread_mutex_init(&_mutex, 0);
62  if (err != 0) {
63  throw LSST_EXCEPT(lsst::pex::exceptions::RuntimeError,
64  (boost::format("pthread_mutex_init() failed, return code: %1%") % err).str());
65  }
66  }
::pthread_mutex_t _mutex
Definition: Mutex.h:75
#define LSST_EXCEPT(type,...)
Definition: Exception.h:46
lsst::ap::Mutex::~Mutex ( )
inline

Definition at line 68 of file Mutex.h.

68  {
69  int result = ::pthread_mutex_destroy(&_mutex);
70  assert(result == 0);
71  }
::pthread_mutex_t _mutex
Definition: Mutex.h:75

Member Function Documentation

void lsst::ap::Mutex::acquire ( )
inlineprivate

Definition at line 77 of file Mutex.h.

77  {
78  int result = ::pthread_mutex_lock(&_mutex);
79  assert(result == 0);
80  }
::pthread_mutex_t _mutex
Definition: Mutex.h:75
void lsst::ap::Mutex::release ( )
inlineprivate

Definition at line 86 of file Mutex.h.

86  {
87  int result = ::pthread_mutex_unlock(&_mutex);
88  assert(result == 0);
89  }
::pthread_mutex_t _mutex
Definition: Mutex.h:75
bool lsst::ap::Mutex::tryAcquire ( )
inlineprivate

Definition at line 82 of file Mutex.h.

82  {
83  return ::pthread_mutex_trylock(&_mutex) == 0;
84  }
::pthread_mutex_t _mutex
Definition: Mutex.h:75

Friends And Related Function Documentation

friend class Condition< Mutex >
friend

Definition at line 92 of file Mutex.h.

friend class ScopedLock< Mutex >
friend

Definition at line 91 of file Mutex.h.

Member Data Documentation

::pthread_mutex_t lsst::ap::Mutex::_mutex
private

Definition at line 75 of file Mutex.h.


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