MrSID Decode SDK for LiDAR Reference Manual
1.1.4.4709
|
00001 /* ////////////////////////////////////////////////////////////////////////// 00002 // // 00003 // This code is Copyright (c) 2008-2010 LizardTech, Inc, 1008 Western // 00004 // Avenue, Suite 200, Seattle, WA 98104. Unauthorized use or distribution // 00005 // prohibited. Access to and use of this code is permitted only under // 00006 // license from LizardTech, Inc. Portions of the code are protected by // 00007 // US and foreign patents and other filings. All Rights Reserved. // 00008 // // 00010 /* PUBLIC */ 00011 00012 #ifndef __LIDAR_MUTEX_H__ 00013 #define __LIDAR_MUTEX_H__ 00014 00015 #include "lidar/Base.h" 00016 00017 #ifdef _WIN32 00018 #define NOMINMAX 00019 #include <windows.h> 00020 #else 00021 #include <pthread.h> 00022 #endif 00023 00024 LT_BEGIN_LIDAR_NAMESPACE 00025 00029 class Mutex 00030 { 00031 SIMPLE_OBJECT(Mutex); 00032 public: 00034 Mutex(void); 00036 ~Mutex(void); 00037 00039 void lock(void); 00041 void unlock(void); 00042 private: 00043 #ifdef _WIN32 00044 HANDLE m_mutex; 00045 #else 00046 pthread_mutex_t m_mutex; 00047 #endif 00048 }; 00049 00050 00055 class MutexMonitor 00056 { 00057 DISABLE_COPY(MutexMonitor); 00058 public: 00060 MutexMonitor(Mutex &mutex) : 00061 m_mutex(mutex) 00062 { 00063 m_mutex.lock(); 00064 } 00065 00067 ~MutexMonitor(void) 00068 { 00069 m_mutex.unlock(); 00070 } 00071 private: 00072 Mutex &m_mutex; 00073 }; 00074 00075 LT_END_LIDAR_NAMESPACE 00076 #endif // __LIDAR_MUTEX_H__