| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2012 Google Inc. | 2 * Copyright 2012 Google Inc. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
| 6 */ | 6 */ |
| 7 | 7 |
| 8 #ifndef SkCondVar_DEFINED | 8 #ifndef CondVar_DEFINED |
| 9 #define SkCondVar_DEFINED | 9 #define CondVar_DEFINED |
| 10 |
| 11 #include "SkTypes.h" |
| 10 | 12 |
| 11 #ifdef SK_USE_POSIX_THREADS | 13 #ifdef SK_USE_POSIX_THREADS |
| 12 #include <pthread.h> | 14 #include <pthread.h> |
| 13 #elif defined(SK_BUILD_FOR_WIN32) | 15 #elif defined(SK_BUILD_FOR_WIN32) |
| 14 #include <windows.h> | 16 #include <windows.h> |
| 17 #else |
| 18 #error "CondVar isn't supported on this platform." |
| 15 #endif | 19 #endif |
| 16 | 20 |
| 17 /** | 21 /** |
| 18 * Condition variable for blocking access to shared data from other threads and | 22 * Condition variable for blocking access to shared data from other threads and |
| 19 * controlling which threads are awake. | 23 * controlling which threads are awake. |
| 20 * | 24 * |
| 21 * Currently only supported on platforms with posix threads and Windows Vista an
d | 25 * Currently only supported on platforms with posix threads and Windows Vista an
d |
| 22 * above. | 26 * above. |
| 23 */ | 27 */ |
| 24 class SkCondVar { | 28 class CondVar { |
| 25 public: | 29 public: |
| 26 SkCondVar(); | 30 CondVar(); |
| 27 ~SkCondVar(); | 31 ~CondVar(); |
| 28 | 32 |
| 29 /** | 33 /** |
| 30 * Lock a mutex. Must be done before calling the other functions on this obj
ect. | 34 * Lock a mutex. Must be done before calling the other functions on this obj
ect. |
| 31 */ | 35 */ |
| 32 void lock(); | 36 void lock(); |
| 33 | 37 |
| 34 /** | 38 /** |
| 35 * Unlock the mutex. | 39 * Unlock the mutex. |
| 36 */ | 40 */ |
| 37 void unlock(); | 41 void unlock(); |
| (...skipping 21 matching lines...) Expand all Loading... |
| 59 #ifdef SK_USE_POSIX_THREADS | 63 #ifdef SK_USE_POSIX_THREADS |
| 60 pthread_mutex_t fMutex; | 64 pthread_mutex_t fMutex; |
| 61 pthread_cond_t fCond; | 65 pthread_cond_t fCond; |
| 62 #elif defined(SK_BUILD_FOR_WIN32) | 66 #elif defined(SK_BUILD_FOR_WIN32) |
| 63 CRITICAL_SECTION fCriticalSection; | 67 CRITICAL_SECTION fCriticalSection; |
| 64 CONDITION_VARIABLE fCondition; | 68 CONDITION_VARIABLE fCondition; |
| 65 #endif | 69 #endif |
| 66 }; | 70 }; |
| 67 | 71 |
| 68 #endif | 72 #endif |
| OLD | NEW |