Belle II Software
release-05-01-25
LockGuard.h
1
#ifndef _Belle2_LockGuard_hh
2
#define _Belle2_LockGuard_hh
3
4
#include <daq/slc/system/Mutex.h>
5
#include "MMutex.h"
6
7
namespace
Belle2
{
39
template
<
class
AMutex>
40
class
GenericLockGuard
{
41
public
:
43
explicit
GenericLockGuard
(AMutex& mutex) :
m_mutex
(mutex)
44
{
45
m_mutex
.lock();
46
}
47
49
~GenericLockGuard
()
50
{
51
m_mutex
.unlock();
52
}
53
54
private
:
56
GenericLockGuard
(
const
GenericLockGuard
&);
57
59
GenericLockGuard
&
operator=
(
const
GenericLockGuard
&);
60
62
AMutex&
m_mutex
;
63
};
64
65
typedef
GenericLockGuard<Mutex>
LockGuard
;
66
typedef
GenericLockGuard<MMutex>
MLockGuard
;
68
}
69
70
#endif
Belle2::GenericLockGuard::~GenericLockGuard
~GenericLockGuard()
Automatically release the lock on destruction.
Definition:
LockGuard.h:49
Belle2::GenericLockGuard::GenericLockGuard
GenericLockGuard(AMutex &mutex)
Construct a new LockGuard locking the mutex.
Definition:
LockGuard.h:43
Belle2::GenericLockGuard
Lock Guard for a Mutex instance.
Definition:
LockGuard.h:40
Belle2
Abstract base class for different kinds of events.
Definition:
MillepedeAlgorithm.h:19
Belle2::GenericLockGuard::m_mutex
AMutex & m_mutex
The mutex hold by this lock guard.
Definition:
LockGuard.h:62
Belle2::GenericLockGuard::operator=
GenericLockGuard & operator=(const GenericLockGuard &)
Do not allow to copy a lock guard.
daq
slc
system
include
LockGuard.h
Generated on Fri Nov 5 2021 03:50:12 for Belle II Software by
1.8.17