Main Page
Namespace List
Class Hierarchy
Alphabetical List
Compound List
File List
Namespace Members
Compound Members
File Members
Source
igtlConditionVariable.h
Go to the documentation of this file.
1
/*=========================================================================
2
3
Program: The OpenIGTLink Library
4
Language: C++
5
Web page: http://openigtlink.org/
6
7
Copyright (c) Insight Software Consortium. All rights reserved.
8
9
This software is distributed WITHOUT ANY WARRANTY; without even
10
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
11
PURPOSE. See the above copyright notices for more information.
12
13
=========================================================================*/
14
/*=========================================================================
15
16
Program: Insight Segmentation & Registration Toolkit
17
Module: $RCSfile: itkConditionVariable.h,v $
18
Language: C++
19
Date: $Date: 2008-12-22 19:05:42 -0500 (Mon, 22 Dec 2008) $
20
Version: $Revision: 3460 $
21
22
Copyright (c) Insight Software Consortium. All rights reserved.
23
See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details.
24
25
This software is distributed WITHOUT ANY WARRANTY; without even
26
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
27
PURPOSE. See the above copyright notices for more information.
28
29
=========================================================================*/
30
#ifndef __igtlConditionVariable_h
31
#define __igtlConditionVariable_h
32
33
#include "igtlConfigure.h"
34
35
// This implementation uses a routine called SignalObjectAndWait()
36
// which is only defined on WinNT 4.0 or greater systems. We need to
37
// define this symbol in order to get the prototype for the
38
// routine. This needs to be done before we load any system headers.
39
#ifdef OpenIGTLink_USE_WIN32_THREADS
40
#undef _WIN32_WINNT
41
#define _WIN32_WINNT 0x0400
42
#include "
igtlWindows.h
"
43
#endif
44
45
46
#include "
igtlMutexLock.h
"
47
#include "
igtlLightObject.h
"
48
49
50
namespace
igtl
{
51
82
class
IGTLCommon_EXPORT
ConditionVariable
:
public
LightObject
83
{
84
public
:
86
typedef
ConditionVariable
Self
;
87
typedef
LightObject
Superclass
;
88
typedef
SmartPointer<Self>
Pointer
;
89
typedef
SmartPointer<const Self>
ConstPointer
;
90
92
igtlNewMacro
(
Self
);
93
95
igtlTypeMacro
(
ConditionVariable
,
LightObject
);
96
100
void
Wait(
SimpleMutexLock
* mutex);
101
103
void
Signal();
104
106
void
Broadcast();
107
108
protected
:
109
ConditionVariable
();
110
~
ConditionVariable
();
111
112
private
:
113
ConditionVariable
(
const
Self
& other);
114
const
Self
& operator=(
const
Self
& );
115
#ifdef OpenIGTLink_USE_PTHREADS
116
pthread_cond_t m_ConditionVariable;
117
MutexType
m_Mutex;
118
#else
119
int
m_NumberOfWaiters;
// number of waiting threads
120
#ifdef WIN32
121
CRITICAL_SECTION m_NumberOfWaitersLock;
// Serialize access to
122
// m_NumberOfWaiters
123
124
HANDLE m_Semaphore;
// Semaphore to queue threads
125
HANDLE m_WaitersAreDone;
// Auto-reset event used by the
126
// broadcast/signal thread to
127
// wait for all the waiting
128
// threads to wake up and
129
// release the semaphore
130
131
size_t
m_WasBroadcast;
// Keeps track of whether we
132
// were broadcasting or signaling
133
#endif
134
#endif
135
};
136
137
}
// end namespace igtl
138
139
#endif
igtl::SimpleMutexLock
Simple mutual exclusion locking class.
Definition:
igtlMutexLock.h:83
igtlNewMacro
#define igtlNewMacro(x)
Definition:
igtlMacro.h:431
igtl::ConditionVariable::Self
ConditionVariable Self
Definition:
igtlConditionVariable.h:86
igtl::ConditionVariable::Superclass
LightObject Superclass
Definition:
igtlConditionVariable.h:87
igtl
The "igtl" namespace contains all OpenIGTLink classes. There are several nested namespaces within the...
Definition:
igtlBindMessage.h:25
IGTLCommon_EXPORT
#define IGTLCommon_EXPORT
Definition:
igtlWin32Header.h:151
igtlMutexLock.h
igtl::ConditionVariable::ConstPointer
SmartPointer< const Self > ConstPointer
Definition:
igtlConditionVariable.h:89
igtl::MutexType
int MutexType
Definition:
igtlMutexLock.h:69
igtlWindows.h
igtl::ConditionVariable
A thread synchronization object used to suspend execution until some condition on shared data is met.
Definition:
igtlConditionVariable.h:82
igtlLightObject.h
igtl::SmartPointer< Self >
igtlTypeMacro
#define igtlTypeMacro(thisClass, superclass)
Definition:
igtlMacro.h:486
igtl::LightObject
Light weight base class for most igtl classes.
Definition:
igtlLightObject.h:58
igtl::ConditionVariable::Pointer
SmartPointer< Self > Pointer
Definition:
igtlConditionVariable.h:88
Generated for OpenIGTLink by
Doxygen
1.8.17 written by
Dimitri van Heesch
, © 1997-2012