Chromium Code Reviews| 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 SkCondVar_DEFINED |
| 9 #define SkCondVar_DEFINED | 9 #define SkCondVar_DEFINED |
| 10 | 10 |
| 11 /** | |
| 12 * Import any thread model setting from configuration files. | |
|
reed1
2014/07/08 13:19:55
Does this comment belong here, or above <pthread.h
scroggo
2014/07/08 13:23:44
The include of SkTypes.h is to make sure that SK_U
| |
| 13 */ | |
| 14 #include "SkTypes.h" | |
| 15 | |
| 11 #ifdef SK_USE_POSIX_THREADS | 16 #ifdef SK_USE_POSIX_THREADS |
| 12 #include <pthread.h> | 17 #include <pthread.h> |
| 13 #elif defined(SK_BUILD_FOR_WIN32) | 18 #elif defined(SK_BUILD_FOR_WIN32) |
| 14 #include <windows.h> | 19 #include <windows.h> |
| 20 #else | |
| 21 /** | |
| 22 * Warn if the implementation of this class is empty, i.e. thread safety is not working. | |
| 23 */ | |
| 24 #warning "Thread safety class SkCondVar has no implementation!" | |
| 15 #endif | 25 #endif |
| 16 | 26 |
| 17 /** | 27 /** |
| 18 * Condition variable for blocking access to shared data from other threads and | 28 * Condition variable for blocking access to shared data from other threads and |
| 19 * controlling which threads are awake. | 29 * controlling which threads are awake. |
| 20 * | 30 * |
| 21 * Currently only supported on platforms with posix threads and Windows Vista an d | 31 * Currently only supported on platforms with posix threads and Windows Vista an d |
| 22 * above. | 32 * above. |
| 23 */ | 33 */ |
| 24 class SkCondVar { | 34 class SkCondVar { |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 59 #ifdef SK_USE_POSIX_THREADS | 69 #ifdef SK_USE_POSIX_THREADS |
| 60 pthread_mutex_t fMutex; | 70 pthread_mutex_t fMutex; |
| 61 pthread_cond_t fCond; | 71 pthread_cond_t fCond; |
| 62 #elif defined(SK_BUILD_FOR_WIN32) | 72 #elif defined(SK_BUILD_FOR_WIN32) |
| 63 CRITICAL_SECTION fCriticalSection; | 73 CRITICAL_SECTION fCriticalSection; |
| 64 CONDITION_VARIABLE fCondition; | 74 CONDITION_VARIABLE fCondition; |
| 65 #endif | 75 #endif |
| 66 }; | 76 }; |
| 67 | 77 |
| 68 #endif | 78 #endif |
| OLD | NEW |