Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(121)

Side by Side Diff: src/utils/SkCondVar.h

Issue 869443003: Don't require -DSK_USE_POSIX_THREADS. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/core/SkPixelRef.cpp ('k') | src/utils/SkCondVar.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #include "SkTypes.h" 11 #include "SkTypes.h"
12 12
13 #ifdef SK_USE_POSIX_THREADS 13 #ifdef SK_BUILD_FOR_WIN32
14 #include <pthread.h>
15 #elif defined(SK_BUILD_FOR_WIN32)
16 #include <windows.h> 14 #include <windows.h>
17 #else 15 #else
18 #error "SkCondVar requires pthreads or Windows." 16 #include <pthread.h>
19 #endif 17 #endif
20 18
21 /** 19 /**
22 * Condition variable for blocking access to shared data from other threads and 20 * Condition variable for blocking access to shared data from other threads and
23 * controlling which threads are awake. 21 * controlling which threads are awake.
24 * 22 *
25 * Currently only supported on platforms with posix threads and Windows Vista an d above. 23 * Currently only supported on platforms with posix threads and Windows Vista an d above.
26 */ 24 */
27 class SkCondVar { 25 class SkCondVar {
28 public: 26 public:
(...skipping 28 matching lines...) Expand all
57 */ 55 */
58 void signal(); 56 void signal();
59 57
60 /** 58 /**
61 * Wake all threads waiting on this condition. Must be called while lock() 59 * Wake all threads waiting on this condition. Must be called while lock()
62 * is held. 60 * is held.
63 */ 61 */
64 void broadcast(); 62 void broadcast();
65 63
66 private: 64 private:
67 #ifdef SK_USE_POSIX_THREADS 65 #ifdef SK_BUILD_FOR_WIN32
66 CRITICAL_SECTION fCriticalSection;
67 CONDITION_VARIABLE fCondition;
68 #else
68 pthread_mutex_t fMutex; 69 pthread_mutex_t fMutex;
69 pthread_cond_t fCond; 70 pthread_cond_t fCond;
70 #elif defined(SK_BUILD_FOR_WIN32)
71 CRITICAL_SECTION fCriticalSection;
72 CONDITION_VARIABLE fCondition;
73 #endif 71 #endif
74 }; 72 };
75 73
76 #endif 74 #endif
OLDNEW
« no previous file with comments | « src/core/SkPixelRef.cpp ('k') | src/utils/SkCondVar.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698