Main Page Class Hierarchy Alphabetical List Compound List File List Compound Members File Members Related Pages
Common/vtkMutexLock.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00041 #ifndef __vtkMutexVariable_h
00042 #define __vtkMutexVariable_h
00043
00044
00045 #include "vtkObject.h"
00046
00047
00048
00049 #ifdef VTK_USE_SPROC
00050 #include <abi_mutex.h>
00051 typedef abilock_t vtkMutexType;
00052 #endif
00053
00054 #if defined(VTK_USE_PTHREADS) || defined(VTK_HP_PTHREADS)
00055 #include <pthread.h>
00056 typedef pthread_mutex_t vtkMutexType;
00057 #endif
00058
00059 #ifdef VTK_USE_WIN32_THREADS
00060 #include <winbase.h>
00061 typedef HANDLE vtkMutexType;
00062 #endif
00063
00064 #ifndef VTK_USE_SPROC
00065 #ifndef VTK_USE_PTHREADS
00066 #ifndef VTK_USE_WIN32_THREADS
00067 typedef int vtkMutexType;
00068 #endif
00069 #endif
00070 #endif
00071
00072
00073 class VTK_COMMON_EXPORT vtkSimpleMutexLock
00074 {
00075 public:
00076
00077 vtkSimpleMutexLock();
00078 virtual ~vtkSimpleMutexLock();
00079
00080 static vtkSimpleMutexLock *New();
00081
00082 virtual const char *GetClassName() {return "vtkSimpleMutexLock";};
00083 virtual int IsA(const char *name);
00084 static vtkSimpleMutexLock *SafeDownCast(vtkSimpleMutexLock *o);
00085
00086 void Delete() {delete this;}
00087
00089 void Lock( void );
00090
00092 void Unlock( void );
00093
00094 protected:
00095 vtkMutexType MutexLock;
00096 };
00097
00098
00099
00100 class VTK_COMMON_EXPORT vtkMutexLock : public vtkObject
00101 {
00102 public:
00103 static vtkMutexLock *New();
00104
00105 vtkTypeRevisionMacro(vtkMutexLock,vtkObject);
00106 void PrintSelf(ostream& os, vtkIndent indent);
00107
00109 void Lock( void );
00110
00112 void Unlock( void );
00113
00114 protected:
00115 vtkSimpleMutexLock SimpleMutexLock;
00116 vtkMutexLock() {};
00117 private:
00118 vtkMutexLock(const vtkMutexLock&);
00119 void operator=(const vtkMutexLock&);
00120 };
00121
00122
00123 inline void vtkMutexLock::Lock( void )
00124 {
00125 this->SimpleMutexLock.Lock();
00126 }
00127
00128 inline void vtkMutexLock::Unlock( void )
00129 {
00130 this->SimpleMutexLock.Unlock();
00131 }
00132
00133 #endif