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

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

Issue 700683002: Manually load CONDITION_VARIABLE methods on Windows, checking for failure (XP). (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: winapi Created 6 years, 1 month 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/SkTaskGroup.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 /**
12 * Import any thread model setting from configuration files.
13 */
14 #include "SkTypes.h" 11 #include "SkTypes.h"
15 12
16 #ifdef SK_USE_POSIX_THREADS 13 #ifdef SK_USE_POSIX_THREADS
17 #include <pthread.h> 14 #include <pthread.h>
18 #elif defined(SK_BUILD_FOR_WIN32) 15 #elif defined(SK_BUILD_FOR_WIN32)
19 #include <windows.h> 16 #include <windows.h>
20 #else 17 #else
21 /** 18 #error "SkCondVar requires pthreads or Windows."
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!"
25 #endif 19 #endif
26 20
27 /** 21 /**
28 * 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
29 * controlling which threads are awake. 23 * controlling which threads are awake.
30 * 24 *
31 * 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 above.
32 * above.
33 */ 26 */
34 class SkCondVar { 27 class SkCondVar {
35 public: 28 public:
29 /** Returns true if it makes sense to create and use SkCondVars.
30 * You _MUST_ call this method and it must return true before creating any SkCondVars.
31 */
32 static bool Supported();
33
36 SkCondVar(); 34 SkCondVar();
37 ~SkCondVar(); 35 ~SkCondVar();
38 36
39 /** 37 /**
40 * Lock a mutex. Must be done before calling the other functions on this obj ect. 38 * Lock a mutex. Must be done before calling the other functions on this obj ect.
41 */ 39 */
42 void lock(); 40 void lock();
43 41
44 /** 42 /**
45 * Unlock the mutex. 43 * Unlock the mutex.
(...skipping 23 matching lines...) Expand all
69 #ifdef SK_USE_POSIX_THREADS 67 #ifdef SK_USE_POSIX_THREADS
70 pthread_mutex_t fMutex; 68 pthread_mutex_t fMutex;
71 pthread_cond_t fCond; 69 pthread_cond_t fCond;
72 #elif defined(SK_BUILD_FOR_WIN32) 70 #elif defined(SK_BUILD_FOR_WIN32)
73 CRITICAL_SECTION fCriticalSection; 71 CRITICAL_SECTION fCriticalSection;
74 CONDITION_VARIABLE fCondition; 72 CONDITION_VARIABLE fCondition;
75 #endif 73 #endif
76 }; 74 };
77 75
78 #endif 76 #endif
OLDNEW
« no previous file with comments | « src/core/SkTaskGroup.cpp ('k') | src/utils/SkCondVar.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698