VTK
9.1.0
Common
Core
vtkCriticalSection.h
Go to the documentation of this file.
1
/*=========================================================================
2
3
Program: Visualization Toolkit
4
Module: vtkCriticalSection.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
=========================================================================*/
36
#ifndef vtkCriticalSection_h
37
#define vtkCriticalSection_h
38
39
#include "vtkCommonCoreModule.h"
// For export macro
40
#include "
vtkObject.h
"
41
#include <mutex>
// for std::mutex
42
43
class
VTKCOMMONCORE_EXPORT
vtkCriticalSection
:
public
vtkObject
44
{
45
public
:
46
static
vtkCriticalSection
*
New
();
47
48
vtkTypeMacro(
vtkCriticalSection
,
vtkObject
);
49
void
PrintSelf
(ostream& os,
vtkIndent
indent)
override
;
50
54
void
Lock();
55
59
void
Unlock();
60
61
protected
:
62
std::mutex
mtx
;
63
vtkCriticalSection
() =
default
;
64
~vtkCriticalSection
()
override
=
default
;
65
66
private
:
67
vtkCriticalSection
(
const
vtkCriticalSection
&) =
delete
;
68
void
operator=(
const
vtkCriticalSection
&) =
delete
;
69
};
70
71
inline
void
vtkCriticalSection::Lock
()
72
{
73
this->
mtx
.lock();
74
}
75
76
inline
void
vtkCriticalSection::Unlock
()
77
{
78
this->
mtx
.unlock();
79
}
80
81
#endif
vtkCriticalSection::vtkCriticalSection
vtkCriticalSection()=default
vtkCriticalSection::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkObject
abstract base class for most VTK objects
Definition:
vtkObject.h:82
vtkCriticalSection::New
static vtkCriticalSection * New()
vtkCriticalSection::Lock
void Lock()
Lock the vtkCriticalSection.
Definition:
vtkCriticalSection.h:71
vtkIndent
a simple class to control print indentation
Definition:
vtkIndent.h:113
vtkObject.h
vtkCriticalSection
Critical section locking class.
Definition:
vtkCriticalSection.h:44
vtkCriticalSection::Unlock
void Unlock()
Unlock the vtkCriticalSection.
Definition:
vtkCriticalSection.h:76
vtkCriticalSection::~vtkCriticalSection
~vtkCriticalSection() override=default
vtkCriticalSection::mtx
std::mutex mtx
Definition:
vtkCriticalSection.h:62
Generated on Fri Nov 5 2021 00:10:33 for VTK by
1.8.20