VTK
dox
Common
Core
vtkMutexLock.h
Go to the documentation of this file.
1
/*=========================================================================
2
3
Program: Visualization Toolkit
4
Module: vtkMutexLock.h
5
6
Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7
All rights reserved.
8
See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9
10
This software is distributed WITHOUT ANY WARRANTY; without even
11
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12
PURPOSE. See the above copyright notice for more information.
13
14
=========================================================================*/
27
#ifndef vtkMutexLock_h
28
#define vtkMutexLock_h
29
30
31
#include "vtkCommonCoreModule.h"
// For export macro
32
#include "
vtkObject.h
"
33
34
#ifdef VTK_USE_SPROC
35
#include <abi_mutex.h>
// Needed for SPROC implementation of mutex
36
typedef
abilock_t
vtkMutexType
;
37
#endif
38
39
#if defined(VTK_USE_PTHREADS) || defined(VTK_HP_PTHREADS)
40
#include <pthread.h>
// Needed for PTHREAD implementation of mutex
41
typedef
pthread_mutex_t
vtkMutexType
;
42
#endif
43
44
#ifdef VTK_USE_WIN32_THREADS
45
typedef
vtkWindowsHANDLE
vtkMutexType
;
46
#endif
47
48
#ifndef VTK_USE_SPROC
49
#ifndef VTK_USE_PTHREADS
50
#ifndef VTK_USE_WIN32_THREADS
51
typedef
int
vtkMutexType
;
52
#endif
53
#endif
54
#endif
55
56
// Mutex lock that is not a vtkObject.
57
class
VTKCOMMONCORE_EXPORT
vtkSimpleMutexLock
58
{
59
public
:
60
// left public purposely
61
vtkSimpleMutexLock
();
62
virtual
~
vtkSimpleMutexLock
();
63
64
static
vtkSimpleMutexLock
*New();
65
66
void
Delete
() {
delete
this
;}
67
71
void
Lock(
void
);
72
76
void
Unlock(
void
);
77
78
protected
:
79
friend
class
vtkSimpleConditionVariable
;
80
vtkMutexType
MutexLock
;
81
82
private
:
83
vtkSimpleMutexLock
(
const
vtkSimpleMutexLock
& other) VTK_DELETE_FUNCTION;
84
vtkSimpleMutexLock
& operator=(
const
vtkSimpleMutexLock
& rhs) VTK_DELETE_FUNCTION;
85
};
86
87
class
VTKCOMMONCORE_EXPORT
vtkMutexLock
:
public
vtkObject
88
{
89
public
:
90
static
vtkMutexLock
*
New
();
91
92
vtkTypeMacro(
vtkMutexLock
,
vtkObject
);
93
void
PrintSelf
(ostream& os,
vtkIndent
indent) VTK_OVERRIDE;
94
98
void
Lock(
void
);
99
103
void
Unlock(
void
);
104
105
protected
:
106
107
friend
class
vtkConditionVariable
;
// needs to get at SimpleMutexLock.
108
109
vtkSimpleMutexLock
SimpleMutexLock
;
110
vtkMutexLock
() {}
111
private
:
112
vtkMutexLock
(
const
vtkMutexLock
&) VTK_DELETE_FUNCTION;
113
void
operator=(
const
vtkMutexLock
&) VTK_DELETE_FUNCTION;
114
};
115
116
117
inline
void
vtkMutexLock::Lock
(
void
)
118
{
119
this->
SimpleMutexLock
.
Lock
();
120
}
121
122
inline
void
vtkMutexLock::Unlock
(
void
)
123
{
124
this->
SimpleMutexLock
.
Unlock
();
125
}
126
127
#endif
vtkMutexType
int vtkMutexType
Definition:
vtkMutexLock.h:51
vtkMutexLock::SimpleMutexLock
vtkSimpleMutexLock SimpleMutexLock
Definition:
vtkMutexLock.h:109
vtkMutexLock::Lock
void Lock(void)
Lock the vtkMutexLock.
Definition:
vtkMutexLock.h:117
vtkMutexLock
mutual exclusion locking class
Definition:
vtkMutexLock.h:87
vtkObject::New
static vtkObject * New()
Create an object with Debug turned off, modified time initialized to zero, and reference counting on.
vtkObject
abstract base class for most VTK objects
Definition:
vtkObject.h:59
vtkSimpleMutexLock::Delete
void Delete()
Definition:
vtkMutexLock.h:66
vtkSimpleMutexLock::Lock
void Lock(void)
Lock the vtkMutexLock.
vtkMutexLock::vtkMutexLock
vtkMutexLock()
Definition:
vtkMutexLock.h:110
vtkIndent
a simple class to control print indentation
Definition:
vtkIndent.h:39
vtkSimpleMutexLock::Unlock
void Unlock(void)
Unlock the vtkMutexLock.
vtkObject::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkObject.h
vtkSimpleMutexLock::MutexLock
vtkMutexType MutexLock
Definition:
vtkMutexLock.h:80
vtkSimpleMutexLock
Definition:
vtkMutexLock.h:57
vtkConditionVariable
mutual exclusion locking class
Definition:
vtkConditionVariable.h:151
vtkSimpleConditionVariable
Definition:
vtkConditionVariable.h:112
vtkMutexLock::Unlock
void Unlock(void)
Unlock the vtkMutexLock.
Definition:
vtkMutexLock.h:122
Generated by
1.8.17