Belle II Software development
Mutex Class Reference

Public Member Functions

bool lock ()
 
bool unlock ()
 

Private Attributes

pthread_mutex_t m_mu
 
pthread_mutexattr_t m_attr
 

Friends

class Cond
 

Detailed Description

Definition at line 19 of file Mutex.h.

Constructor & Destructor Documentation

◆ Mutex()

Mutex ( )

Definition at line 12 of file Mutex.cc.

13{
14 pthread_mutexattr_init(&m_attr);
15 pthread_mutex_init(&m_mu, &m_attr);
16}

◆ ~Mutex()

~Mutex ( )

Definition at line 18 of file Mutex.cc.

19{
20}

Member Function Documentation

◆ lock()

bool lock ( )

Definition at line 22 of file Mutex.cc.

23{
24 if (pthread_mutex_lock(&m_mu) != 0) {
25 return false;
26 }
27 return true;
28}

◆ unlock()

bool unlock ( )

Definition at line 30 of file Mutex.cc.

31{
32 if (pthread_mutex_unlock(&m_mu) != 0) {
33 return false;
34 }
35 return true;
36}

Friends And Related Function Documentation

◆ Cond

friend class Cond
friend

Definition at line 21 of file Mutex.h.

Member Data Documentation

◆ m_attr

pthread_mutexattr_t m_attr
private

Definition at line 36 of file Mutex.h.

◆ m_mu

pthread_mutex_t m_mu
private

Definition at line 35 of file Mutex.h.


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