Belle II Software  release-08-01-10
Mutex.cc
1 /**************************************************************************
2  * basf2 (Belle II Analysis Software Framework) *
3  * Author: The Belle II Collaboration *
4  * *
5  * See git log for contributors and copyright holders. *
6  * This file is licensed under LGPL-3.0, see LICENSE.md. *
7  **************************************************************************/
8 #include "daq/slc/system/Mutex.h"
9 
10 using namespace Belle2;
11 
12 Mutex::Mutex()
13 {
14  pthread_mutexattr_init(&m_attr);
15  pthread_mutex_init(&m_mu, &m_attr);
16 }
17 
18 Mutex::~Mutex()
19 {
20 }
21 
22 bool Mutex::lock()
23 {
24  if (pthread_mutex_lock(&m_mu) != 0) {
25  return false;
26  }
27  return true;
28 }
29 
30 bool Mutex::unlock()
31 {
32  if (pthread_mutex_unlock(&m_mu) != 0) {
33  return false;
34  }
35  return true;
36 }
Abstract base class for different kinds of events.