VTK
9.1.0
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 "
vtkDeprecation.h
"
// For VTK_DEPRECATED_IN_9_1_0
29
#include "
vtkObject.h
"
30
#include "vtkThreads.h"
// for VTK_USE_PTHREADS and VTK_USE_WIN32_THREADS
31
32
#if defined(VTK_USE_PTHREADS)
33
#include <pthread.h>
// Needed for PTHREAD implementation of mutex
34
typedef
pthread_mutex_t
vtkMutexType
;
35
#endif
36
37
#ifdef VTK_USE_WIN32_THREADS
38
typedef
vtkWindowsHANDLE
vtkMutexType
;
39
#endif
40
41
#ifndef VTK_USE_PTHREADS
42
#ifndef VTK_USE_WIN32_THREADS
43
typedef
int
vtkMutexType
;
44
#endif
45
#endif
46
47
// Mutex lock that is not a vtkObject.
48
49
class
VTK_DEPRECATED_IN_9_1_0
("Use std::mutex instead.") VTKCOMMONCORE_EXPORT
vtkSimpleMutexLock
50
{
51
public
:
52
// left public purposely
53
vtkSimpleMutexLock
();
54
virtual
~vtkSimpleMutexLock
();
55
56
static
vtkSimpleMutexLock
*
New
();
57
58
void
Delete
() {
delete
this
; }
59
63
void
Lock
(
void
);
64
68
void
Unlock
(
void
);
69
70
protected
:
71
friend
class
vtkSimpleConditionVariable
;
72
vtkMutexType
MutexLock
;
73
74
private
:
75
vtkSimpleMutexLock
(
const
vtkSimpleMutexLock
& other) =
delete
;
76
vtkSimpleMutexLock
& operator=(
const
vtkSimpleMutexLock
& rhs) =
delete
;
77
};
78
79
class
VTK_DEPRECATED_IN_9_1_0
("Use std::mutex instead.") VTKCOMMONCORE_EXPORT
vtkMutexLock
80
:
public
vtkObject
81
{
82
public
:
83
static
vtkMutexLock
*
New
();
84
85
vtkTypeMacro(
vtkMutexLock
,
vtkObject
);
86
void
PrintSelf
(ostream& os,
vtkIndent
indent)
override
;
87
91
void
Lock
(
void
);
92
96
void
Unlock
(
void
);
97
98
protected
:
99
friend
class
vtkConditionVariable
;
// needs to get at SimpleMutexLock.
100
101
vtkSimpleMutexLock
SimpleMutexLock
;
102
vtkMutexLock
() =
default
;
103
104
private
:
105
vtkMutexLock
(
const
vtkMutexLock
&) =
delete
;
106
void
operator=(
const
vtkMutexLock
&) =
delete
;
107
};
108
109
inline
void
vtkMutexLock::Lock
(
void
)
110
{
111
this->
SimpleMutexLock
.
Lock
();
112
}
113
114
inline
void
vtkMutexLock::Unlock
(
void
)
115
{
116
this->
SimpleMutexLock
.
Unlock
();
117
}
118
119
#endif
120
121
// VTK-HeaderTest-Exclude: vtkMutexLock.h
vtkMutexLock::vtkMutexLock
vtkMutexLock()=default
vtkMutexType
int vtkMutexType
Definition:
vtkMutexLock.h:43
vtkMutexLock::SimpleMutexLock
vtkSimpleMutexLock SimpleMutexLock
Definition:
vtkMutexLock.h:101
vtkMutexLock::Lock
void Lock(void)
Lock the vtkMutexLock.
Definition:
vtkMutexLock.h:109
vtkMutexLock
mutual exclusion locking class
Definition:
vtkMutexLock.h:81
vtkObject
abstract base class for most VTK objects
Definition:
vtkObject.h:82
VTK_DEPRECATED_IN_9_1_0
#define VTK_DEPRECATED_IN_9_1_0(reason)
Definition:
vtkDeprecation.h:117
vtkSimpleMutexLock::Delete
void Delete()
Definition:
vtkMutexLock.h:58
vtkSimpleMutexLock::New
static vtkSimpleMutexLock * New()
vtkSimpleMutexLock::Lock
void Lock(void)
Lock the vtkMutexLock.
vtkIndent
a simple class to control print indentation
Definition:
vtkIndent.h:113
vtkSimpleMutexLock::Unlock
void Unlock(void)
Unlock the vtkMutexLock.
vtkMutexLock::New
static vtkMutexLock * New()
vtkObject.h
vtkSimpleMutexLock::MutexLock
vtkMutexType MutexLock
Definition:
vtkMutexLock.h:72
vtkSimpleMutexLock
Definition:
vtkMutexLock.h:50
vtkConditionVariable
mutual exclusion locking class
Definition:
vtkConditionVariable.h:154
vtkSimpleConditionVariable
Definition:
vtkConditionVariable.h:112
vtkSimpleMutexLock::~vtkSimpleMutexLock
virtual ~vtkSimpleMutexLock()
vtkDeprecation.h
vtkMutexLock::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkMutexLock::Unlock
void Unlock(void)
Unlock the vtkMutexLock.
Definition:
vtkMutexLock.h:114
vtkSimpleMutexLock::vtkSimpleMutexLock
vtkSimpleMutexLock()
Generated on Fri Nov 5 2021 00:10:56 for VTK by
1.8.20