| OLD | NEW |
| 1 #ifndef ADBLOCKPLUS_THREAD_H | 1 #ifndef ADBLOCKPLUS_THREAD_H |
| 2 #define ADBLOCKPLUS_THREAD_H | 2 #define ADBLOCKPLUS_THREAD_H |
| 3 | 3 |
| 4 #ifdef WIN32 | 4 #ifdef WIN32 |
| 5 #include <windows.h> | 5 #include <windows.h> |
| 6 #else | 6 #else |
| 7 #include <pthread.h> | 7 #include <pthread.h> |
| 8 #endif | 8 #endif |
| 9 | 9 |
| 10 namespace AdblockPlus | 10 namespace AdblockPlus |
| 11 { | 11 { |
| 12 void Sleep(const int millis); |
| 13 |
| 12 class Mutex | 14 class Mutex |
| 13 { | 15 { |
| 14 public: | 16 public: |
| 15 #ifdef WIN32 | 17 #ifdef WIN32 |
| 16 CRITICAL_SECTION nativeMutex; | 18 CRITICAL_SECTION nativeMutex; |
| 17 #else | 19 #else |
| 18 pthread_mutex_t nativeMutex; | 20 pthread_mutex_t nativeMutex; |
| 19 #endif | 21 #endif |
| 20 | 22 |
| 21 Mutex(); | 23 Mutex(); |
| 22 ~Mutex(); | 24 ~Mutex(); |
| 23 void Lock(); | 25 void Lock(); |
| 24 void Unlock(); | 26 void Unlock(); |
| 25 }; | 27 }; |
| 26 | 28 |
| 29 class Lock |
| 30 { |
| 31 public: |
| 32 Lock(Mutex& mutex); |
| 33 ~Lock(); |
| 34 |
| 35 private: |
| 36 Mutex& mutex; |
| 37 }; |
| 38 |
| 27 class ConditionVariable | 39 class ConditionVariable |
| 28 { | 40 { |
| 29 public: | 41 public: |
| 30 ConditionVariable(); | 42 ConditionVariable(); |
| 31 ~ConditionVariable(); | 43 ~ConditionVariable(); |
| 32 void Wait(Mutex& mutex); | 44 void Wait(Mutex& mutex); |
| 33 void Signal(); | 45 void Signal(); |
| 34 | 46 |
| 35 private: | 47 private: |
| 36 #ifdef WIN32 | 48 #ifdef WIN32 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 51 private: | 63 private: |
| 52 #ifdef WIN32 | 64 #ifdef WIN32 |
| 53 HANDLE nativeThread; | 65 HANDLE nativeThread; |
| 54 #else | 66 #else |
| 55 pthread_t nativeThread; | 67 pthread_t nativeThread; |
| 56 #endif | 68 #endif |
| 57 }; | 69 }; |
| 58 } | 70 } |
| 59 | 71 |
| 60 #endif | 72 #endif |
| OLD | NEW |