VTK
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 "vtkSimpleCriticalSection.h" // For simple critical section
42 
43 class VTKCOMMONCORE_EXPORT vtkCriticalSection : public vtkObject
44 {
45 public:
46  static vtkCriticalSection *New();
47 
49  void PrintSelf(ostream& os, vtkIndent indent) VTK_OVERRIDE;
50 
54  void Lock();
55 
59  void Unlock();
60 
61 protected:
64  ~vtkCriticalSection() VTK_OVERRIDE {}
65 
66 private:
67  vtkCriticalSection(const vtkCriticalSection&) VTK_DELETE_FUNCTION;
68  void operator=(const vtkCriticalSection&) VTK_DELETE_FUNCTION;
69 };
70 
71 
72 inline void vtkCriticalSection::Lock()
73 {
74  this->SimpleCriticalSection.Lock();
75 }
76 
78 {
79  this->SimpleCriticalSection.Unlock();
80 }
81 
82 #endif
abstract base class for most VTK objects
Definition: vtkObject.h:59
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
void Lock()
Lock the vtkCriticalSection.
vtkSimpleCriticalSection SimpleCriticalSection
a simple class to control print indentation
Definition: vtkIndent.h:39
~vtkCriticalSection() override
void Unlock()
Unlock the vtkCriticalSection.
Critical section locking class.
void Unlock()
Unlock the vtkCriticalSection.
Critical section locking class.
static vtkObject * New()
Create an object with Debug turned off, modified time initialized to zero, and reference counting on...