igtlSimpleFastMutexLock.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035 #ifndef __igtlSimpleFastMutexLock_h
00036 #define __igtlSimpleFastMutexLock_h
00037
00038 #include "igtlMacro.h"
00039
00040 #ifdef OpenIGTLink_USE_SPROC
00041 #include <abi_mutex.h>
00042 #endif
00043
00044 #ifdef OpenIGTLink_USE_PTHREADS
00045 #include <pthread.h>
00046 #endif
00047
00048 #if defined(_WIN32) && !defined(OpenIGTLink_USE_PTHREADS)
00049 #include "igtlWindows.h"
00050 #endif
00051
00052 namespace igtl
00053 {
00054
00055 #ifdef OpenIGTLink_USE_SPROC
00056 #include <abi_mutex.h>
00057 typedef abilock_t FastMutexType;
00058 #endif
00059
00060 #ifdef OpenIGTLink_USE_PTHREADS
00061 #include <pthread.h>
00062 typedef pthread_mutex_t FastMutexType;
00063 #endif
00064
00065 #if defined(_WIN32) && !defined(OpenIGTLink_USE_PTHREADS)
00066 #include <winbase.h>
00067 typedef CRITICAL_SECTION FastMutexType;
00068 #endif
00069
00070 #ifndef OpenIGTLink_USE_SPROC
00071 #ifndef OpenIGTLink_USE_PTHREADS
00072 #ifndef _WIN32
00073 typedef int FastMutexType;
00074 #endif
00075 #endif
00076 #endif
00077
00088
00089 class IGTLCommon_EXPORT SimpleFastMutexLock
00090 {
00091 public:
00093 typedef SimpleFastMutexLock Self;
00094
00096 SimpleFastMutexLock();
00097 ~SimpleFastMutexLock();
00099
00101 void Lock() const;
00102
00104 void Unlock() const;
00105
00106 protected:
00107 mutable FastMutexType m_FastMutexLock;
00108 };
00109
00110 }
00111 #endif
00112
00113