MeVisLab Toolbox Reference
mlWaitCondition.h
Go to the documentation of this file.
1
/*************************************************************************************
2
**
3
** Copyright 2007, MeVis Medical Solutions AG
4
**
5
** The user may use this file in accordance with the license agreement provided with
6
** the Software or, alternatively, in accordance with the terms contained in a
7
** written agreement between the user and MeVis Medical Solutions AG.
8
**
9
** For further information use the contact form at https://www.mevislab.de/contact
10
**
11
**************************************************************************************/
12
13
#ifndef ML_WAIT_CONDITION_H
14
#define ML_WAIT_CONDITION_H
15
18
19
#include "
mlUtilsSystem.h
"
20
21
#include "
mlMutex.h
"
22
23
ML_UTILS_START_NAMESPACE
24
25
//--------------------------------------------------------------------
28
44
//--------------------------------------------------------------------
45
class
WaitCondition
46
{
47
public
:
48
WaitCondition
() {};
49
50
//--------------------------------------------------------------------
53
//--------------------------------------------------------------------
54
void
wait
(
Lock
& lock)
55
{
56
_condition.wait(lock);
57
}
58
59
//--------------------------------------------------------------------
62
//--------------------------------------------------------------------
63
template
<
typename
duration_type>
bool
wait
(
Lock
& lock, duration_type duration)
64
{
65
return
_condition.timed_wait(lock, duration);
66
}
67
68
//--------------------------------------------------------------------
70
//--------------------------------------------------------------------
71
void
notifyAll
()
72
{
73
_condition.notify_all();
74
}
75
76
//--------------------------------------------------------------------
78
//--------------------------------------------------------------------
79
void
notifyOne
()
80
{
81
_condition.notify_one();
82
}
83
84
private
:
86
boost::condition _condition;
87
};
88
89
ML_UTILS_END_NAMESPACE
90
91
#endif
// __mlWaitCondition_H
ml::WaitCondition::wait
void wait(Lock &lock)
Definition
mlWaitCondition.h:54
ml::WaitCondition::WaitCondition
WaitCondition()
Definition
mlWaitCondition.h:48
ml::WaitCondition::notifyOne
void notifyOne()
Notifies one waiting thread.
Definition
mlWaitCondition.h:79
ml::WaitCondition::notifyAll
void notifyAll()
Notifies all waiting threads.
Definition
mlWaitCondition.h:71
ml::WaitCondition::wait
bool wait(Lock &lock, duration_type duration)
Definition
mlWaitCondition.h:63
mlMutex.h
mlUtilsSystem.h
ml::Lock
boost::mutex::scoped_lock Lock
Defines a lock for locking a non-recursive mutex.
Definition
mlMutex.h:41
MeVis
Foundation
Sources
MLUtilities
mlWaitCondition.h
Generated by
1.15.0