![]() |
Shadowrun: Awakened 29 September 2011 - Build 871
|
00001 00002 00003 00004 00005 00006 00007 00008 00009 #ifndef __SIMPLE_MUTEX_H 00010 #define __SIMPLE_MUTEX_H 00011 00012 #include "RakMemoryOverride.h" 00013 00014 00015 #if defined(_WIN32) 00016 #include "WindowsIncludes.h" 00017 00018 00019 #else 00020 #include <pthread.h> 00021 #include <sys/types.h> 00022 #endif 00023 #include "Export.h" 00024 00025 namespace RakNet 00026 { 00027 00032 class RAK_DLL_EXPORT SimpleMutex 00033 { 00034 public: 00035 00036 // Constructor 00037 SimpleMutex(); 00038 00039 // Destructor 00040 ~SimpleMutex(); 00041 00042 // Locks the mutex. Slow! 00043 void Lock(void); 00044 00045 // Unlocks the mutex. 00046 void Unlock(void); 00047 00048 00049 00050 00051 00052 00053 private: 00054 void Init(void); 00055 #ifdef _WIN32 00056 CRITICAL_SECTION criticalSection; 00057 00058 00059 #else 00060 pthread_mutex_t hMutex; 00061 #endif 00062 // Not threadsafe 00063 // bool isInitialized; 00064 }; 00065 00066 } // namespace RakNet 00067 00068 #endif 00069
Copyright © 2007-2010 by The Shadowrun: Awakened Team. This work is licensed under the GNU Lesser General Public License 3.