VTK
|
00001 /*========================================================================= 00002 00003 Program: Visualization Toolkit 00004 Module: vtkCriticalSection.h 00005 00006 Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen 00007 All rights reserved. 00008 See Copyright.txt or http://www.kitware.com/Copyright.htm for details. 00009 00010 This software is distributed WITHOUT ANY WARRANTY; without even 00011 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 00012 PURPOSE. See the above copyright notice for more information. 00013 00014 =========================================================================*/ 00035 #ifndef vtkCriticalSection_h 00036 #define vtkCriticalSection_h 00037 00038 #include "vtkCommonCoreModule.h" // For export macro 00039 #include "vtkObject.h" 00040 #include "vtkSimpleCriticalSection.h" // For simple critical section 00041 00042 class VTKCOMMONCORE_EXPORT vtkCriticalSection : public vtkObject 00043 { 00044 public: 00045 static vtkCriticalSection *New(); 00046 00047 vtkTypeMacro(vtkCriticalSection,vtkObject); 00048 void PrintSelf(ostream& os, vtkIndent indent); 00049 00051 void Lock(); 00052 00054 void Unlock(); 00055 00056 protected: 00057 vtkSimpleCriticalSection SimpleCriticalSection; 00058 vtkCriticalSection() {} 00059 ~vtkCriticalSection() {} 00060 00061 private: 00062 vtkCriticalSection(const vtkCriticalSection&); // Not implemented. 00063 void operator=(const vtkCriticalSection&); // Not implemented. 00064 }; 00065 00066 00067 inline void vtkCriticalSection::Lock() 00068 { 00069 this->SimpleCriticalSection.Lock(); 00070 } 00071 00072 inline void vtkCriticalSection::Unlock() 00073 { 00074 this->SimpleCriticalSection.Unlock(); 00075 } 00076 00077 #endif