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
=========================================================================*/
24
#ifndef vtkMutexLock_h
25
#define vtkMutexLock_h
26
27
28
#include "vtkCommonCoreModule.h"
// For export macro
29
#include "
vtkObject.h
"
30
31
#if defined(VTK_USE_PTHREADS)
32
#include <pthread.h>
// Needed for PTHREAD implementation of mutex
33
typedef
pthread_mutex_t
vtkMutexType
;
34
#endif
35
36
#ifdef VTK_USE_WIN32_THREADS
37
typedef
vtkWindowsHANDLE
vtkMutexType
;
38
#endif
39
40
#ifndef VTK_USE_PTHREADS
41
#ifndef VTK_USE_WIN32_THREADS
42
typedef
int
vtkMutexType
;
43
#endif
44
#endif
45
46
// Mutex lock that is not a vtkObject.
47
class
VTKCOMMONCORE_EXPORT
vtkSimpleMutexLock
48
{
49
public
:
50
// left public purposely
51
vtkSimpleMutexLock
();
52
virtual
~
vtkSimpleMutexLock
();
53
54
static
vtkSimpleMutexLock
*New();
55
56
void
Delete
() {
delete
this
;}
57
61
void
Lock(
void
);
62
66
void
Unlock(
void
);
67
68
protected
:
69
friend
class
vtkSimpleConditionVariable
;
70
vtkMutexType
MutexLock
;
71
72
private
:
73
vtkSimpleMutexLock
(
const
vtkSimpleMutexLock
& other) =
delete
;
74
vtkSimpleMutexLock
& operator=(
const
vtkSimpleMutexLock
& rhs) =
delete
;
75
};
76
77
class
VTKCOMMONCORE_EXPORT
vtkMutexLock
:
public
vtkObject
78
{
79
public
:
80
static
vtkMutexLock
*
New
();
81
82
vtkTypeMacro(
vtkMutexLock
,
vtkObject
);
83
void
PrintSelf
(ostream& os,
vtkIndent
indent)
override
;
84
88
void
Lock(
void
);
89
93
void
Unlock(
void
);
94
95
protected
:
96
97
friend
class
vtkConditionVariable
;
// needs to get at SimpleMutexLock.
98
99
vtkSimpleMutexLock
SimpleMutexLock
;
100
vtkMutexLock
() {}
101
private
:
102
vtkMutexLock
(
const
vtkMutexLock
&) =
delete
;
103
void
operator=(
const
vtkMutexLock
&) =
delete
;
104
};
105
106
107
inline
void
vtkMutexLock::Lock
(
void
)
108
{
109
this->
SimpleMutexLock
.
Lock
();
110
}
111
112
inline
void
vtkMutexLock::Unlock
(
void
)
113
{
114
this->
SimpleMutexLock
.
Unlock
();
115
}
116
117
#endif
vtkMutexType
int vtkMutexType
Definition:
vtkMutexLock.h:42
vtkMutexLock::SimpleMutexLock
vtkSimpleMutexLock SimpleMutexLock
Definition:
vtkMutexLock.h:99
vtkMutexLock::Lock
void Lock(void)
Lock the vtkMutexLock.
Definition:
vtkMutexLock.h:107
vtkMutexLock
mutual exclusion locking class
Definition:
vtkMutexLock.h:77
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:53
vtkSimpleMutexLock::Delete
void Delete()
Definition:
vtkMutexLock.h:56
vtkSimpleMutexLock::Lock
void Lock(void)
Lock the vtkMutexLock.
vtkMutexLock::vtkMutexLock
vtkMutexLock()
Definition:
vtkMutexLock.h:100
vtkIndent
a simple class to control print indentation
Definition:
vtkIndent.h:33
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:70
vtkSimpleMutexLock
Definition:
vtkMutexLock.h:47
vtkConditionVariable
mutual exclusion locking class
Definition:
vtkConditionVariable.h:146
vtkSimpleConditionVariable
Definition:
vtkConditionVariable.h:107
vtkMutexLock::Unlock
void Unlock(void)
Unlock the vtkMutexLock.
Definition:
vtkMutexLock.h:112
Generated by
1.8.16