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