Main Page
Namespaces
Classes
Files
File List
File Members
src
tools
Mutex.cpp
Go to the documentation of this file.
1
5
#include "
Mutex.hpp
"
6
#include "
errorhandler.hpp
"
7
8
// ****************************************************************************
9
// ScopedLock
10
// ****************************************************************************
11
12
// Konstruktor.
13
// Lock sperren.
14
ScopedLock::ScopedLock
(
Mutex
* mutexPtr)
15
{
16
m_mutexPtr
= mutexPtr;
17
if
(
m_mutexPtr
!= NULL)
18
{
19
m_mutexPtr
->
lock
();
20
}
21
}
22
23
// Destruktor.
24
// Lock wieder freigeben.
25
ScopedLock::~ScopedLock
()
26
{
27
if
(
m_mutexPtr
!= NULL)
28
{
29
m_mutexPtr
->
unlock
();
30
}
31
}
32
33
34
35
// ****************************************************************************
36
// Mutex
37
// ****************************************************************************
38
Mutex::Mutex
()
39
{
40
pthread_mutex_init (&m_mutex, NULL);
41
}
42
43
Mutex::~Mutex
()
44
{
45
}
46
47
void
Mutex::lock
()
48
{
49
pthread_mutex_lock(&m_mutex);
50
}
51
52
void
Mutex::unlock
()
53
{
54
pthread_mutex_unlock(&m_mutex);
55
}
Mutex::Mutex
Mutex()
Definition:
Mutex.cpp:38
Mutex
Definition:
Mutex.hpp:16
Mutex.hpp
ScopedLock::~ScopedLock
~ScopedLock()
Definition:
Mutex.cpp:25
Mutex::~Mutex
~Mutex()
Definition:
Mutex.cpp:43
ScopedLock::ScopedLock
ScopedLock(Mutex *mutexPtr)
Definition:
Mutex.cpp:14
Mutex::unlock
void unlock()
Definition:
Mutex.cpp:52
errorhandler.hpp
ScopedLock::m_mutexPtr
Mutex * m_mutexPtr
Definition:
Mutex.hpp:41
Mutex::lock
void lock()
Definition:
Mutex.cpp:47
libsick_ldmrs
Author(s): SICK AG
, Martin Günther
, Jochen Sprickerhof
autogenerated on Mon Oct 26 2020 03:27:30