1 #pragma once 2 3 #include <time.h> 4 5 #include <MTTypes.h> 6 #include <MTDebug.h> 7 8 typedef void (*TThreadEntryPoint)(void* userData); 9 10 #define ARRAY_SIZE( arr ) ( sizeof( arr ) / sizeof( (arr)[0] ) ) 11 12 namespace MT 13 { 14 namespace EventReset 15 { 16 enum Type 17 { 18 AUTOMATIC = 0, 19 MANUAL = 1, 20 }; 21 } 22 } 23 24 25 26 #ifdef _WIN32 27 #include <Platform/Windows/MTCommon.h> 28 #else 29 #include <Platform/Posix/MTCommon.h> 30 #endif 31 32 33 namespace MT 34 { 35 36 // 37 // 38 // 39 class ScopedGuard 40 { 41 MT::Mutex & mutex; 42 43 ScopedGuard( const ScopedGuard & ) : mutex(*((MT::Mutex*)nullptr)) {} 44 void operator=( const ScopedGuard &) {} 45 46 public: 47 48 ScopedGuard(MT::Mutex & _mutex) : mutex(_mutex) 49 { 50 mutex.Lock(); 51 } 52 53 ~ScopedGuard() 54 { 55 mutex.Unlock(); 56 } 57 }; 58 } 59 60