LSSTApplications  8.0.0.0+107,8.0.0.1+13,9.1+18,9.2,master-g084aeec0a4,master-g0aced2eed8+6,master-g15627eb03c,master-g28afc54ef9,master-g3391ba5ea0,master-g3d0fb8ae5f,master-g4432ae2e89+36,master-g5c3c32f3ec+17,master-g60f1e072bb+1,master-g6a3ac32d1b,master-g76a88a4307+1,master-g7bce1f4e06+57,master-g8ff4092549+31,master-g98e65bf68e,master-ga6b77976b1+53,master-gae20e2b580+3,master-gb584cd3397+53,master-gc5448b162b+1,master-gc54cf9771d,master-gc69578ece6+1,master-gcbf758c456+22,master-gcec1da163f+63,master-gcf15f11bcc,master-gd167108223,master-gf44c96c709
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: