Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
src
icl_core
src
icl_core_thread
ScopedRWLock.cpp
Go to the documentation of this file.
1
// this is for emacs file handling -*- mode: c++; indent-tabs-mode: nil -*-
2
3
// -- BEGIN LICENSE BLOCK ----------------------------------------------
4
// This file is part of FZIs ic_workspace.
5
//
6
// This program is free software licensed under the LGPL
7
// (GNU LESSER GENERAL PUBLIC LICENSE Version 3).
8
// You can find a copy of this license in LICENSE folder in the top
9
// directory of the source code.
10
//
11
// © Copyright 2016 FZI Forschungszentrum Informatik, Karlsruhe, Germany
12
//
13
// -- END LICENSE BLOCK ------------------------------------------------
14
15
//----------------------------------------------------------------------
22
//----------------------------------------------------------------------
23
#include "
icl_core_thread/ScopedRWLock.h
"
24
25
#include "
icl_core_thread/RWLock.h
"
26
27
namespace
icl_core
{
28
namespace
thread {
29
30
ScopedRWLock::ScopedRWLock
(
RWLock
& lock,
LockMode
lock_mode,
bool
force)
31
: m_lock(lock), m_is_locked(false)
32
{
33
if
(lock_mode ==
eLM_READ_LOCK
)
34
{
35
do
{
m_is_locked
=
m_lock
.
readLock
(); }
while
(force && !
m_is_locked
);
36
}
37
else
38
{
39
do
{
m_is_locked
=
m_lock
.
writeLock
(); }
while
(force && !
m_is_locked
);
40
}
41
}
42
43
ScopedRWLock::~ScopedRWLock
()
44
{
45
if
(
isLocked
())
46
{
47
m_lock
.
unlock
();
48
}
49
}
50
52
#ifdef _IC_BUILDER_DEPRECATED_STYLE_
53
57
bool
ScopedRWLock::IsLocked()
const
58
{
59
return
isLocked
();
60
}
61
62
#endif
63
65
}
66
}
ScopedRWLock.h
Contains icl_core::thread::ScopedRWLock.
icl_core::thread::ScopedRWLock::LockMode
LockMode
The type of lock to obtain on the read-write lock.
Definition:
ScopedRWLock.h:54
icl_core::thread::RWLock::unlock
void unlock()
Definition:
RWLock.cpp:161
icl_core::thread::RWLock
Definition:
RWLock.h:47
icl_core::thread::ScopedRWLock::~ScopedRWLock
~ScopedRWLock()
Definition:
ScopedRWLock.cpp:43
RWLock.h
Contains icl_core::thread::RWLock.
icl_core::thread::ScopedRWLock::isLocked
bool isLocked() const
Definition:
ScopedRWLock.h:74
icl_core::thread::ScopedRWLock::ScopedRWLock
ScopedRWLock(RWLock &lock, LockMode lock_mode, bool force=true)
Definition:
ScopedRWLock.cpp:30
icl_core::thread::RWLock::readLock
bool readLock()
Definition:
RWLock.cpp:85
icl_core::thread::ScopedRWLock::m_is_locked
bool m_is_locked
Definition:
ScopedRWLock.h:94
icl_core::thread::ScopedRWLock::m_lock
RWLock & m_lock
Definition:
ScopedRWLock.h:93
icl_core
Definition:
Array2D.h:30
icl_core::thread::ScopedRWLock::eLM_READ_LOCK
Obtain a read lock.
Definition:
ScopedRWLock.h:56
icl_core::thread::RWLock::writeLock
bool writeLock()
Definition:
RWLock.cpp:123
fzi_icl_core
Author(s):
autogenerated on Mon Jun 10 2019 13:17:58