driver
src
tcp
Mutex.cpp
Go to the documentation of this file.
1
5
#include "
sick_scan/tcp/Mutex.hpp
"
6
#include "
sick_scan/tcp/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
}
errorhandler.hpp
Mutex::lock
void lock()
Definition:
Mutex.cpp:47
ScopedLock::ScopedLock
ScopedLock(Mutex *mutexPtr)
Definition:
Mutex.cpp:14
Mutex::~Mutex
~Mutex()
Definition:
Mutex.cpp:43
ScopedLock::~ScopedLock
~ScopedLock()
Definition:
Mutex.cpp:25
Mutex.hpp
Mutex
Definition:
Mutex.hpp:15
Mutex::Mutex
Mutex()
Definition:
Mutex.cpp:38
ScopedLock::m_mutexPtr
Mutex * m_mutexPtr
Definition:
Mutex.hpp:40
Mutex::m_mutex
pthread_mutex_t m_mutex
Definition:
Mutex.hpp:25
Mutex::unlock
void unlock()
Definition:
Mutex.cpp:52
sick_scan
Author(s): Michael Lehning
, Jochen Sprickerhof
, Martin Günther
autogenerated on Thu Sep 8 2022 02:30:19