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

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

Issue 444583006: SkThreadPool and co. are not public. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 4 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 | « gyp/utils.gypi ('k') | include/utils/SkRunnable.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 /*
2 * Copyright 2012 Google Inc.
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7
8 #ifndef SkCondVar_DEFINED
9 #define SkCondVar_DEFINED
10
11 /**
12 * Import any thread model setting from configuration files.
13 */
14 #include "SkTypes.h"
15
16 #ifdef SK_USE_POSIX_THREADS
17 #include <pthread.h>
18 #elif defined(SK_BUILD_FOR_WIN32)
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!"
25 #endif
26
27 /**
28 * Condition variable for blocking access to shared data from other threads and
29 * controlling which threads are awake.
30 *
31 * Currently only supported on platforms with posix threads and Windows Vista an d
32 * above.
33 */
34 class SkCondVar {
35 public:
36 SkCondVar();
37 ~SkCondVar();
38
39 /**
40 * Lock a mutex. Must be done before calling the other functions on this obj ect.
41 */
42 void lock();
43
44 /**
45 * Unlock the mutex.
46 */
47 void unlock();
48
49 /**
50 * Pause the calling thread. Will be awoken when signal() or broadcast() is called.
51 * Must be called while lock() is held (but gives it up while waiting). Once awoken,
52 * the calling thread will hold the lock once again.
53 */
54 void wait();
55
56 /**
57 * Wake one thread waiting on this condition. Must be called while lock()
58 * is held.
59 */
60 void signal();
61
62 /**
63 * Wake all threads waiting on this condition. Must be called while lock()
64 * is held.
65 */
66 void broadcast();
67
68 private:
69 #ifdef SK_USE_POSIX_THREADS
70 pthread_mutex_t fMutex;
71 pthread_cond_t fCond;
72 #elif defined(SK_BUILD_FOR_WIN32)
73 CRITICAL_SECTION fCriticalSection;
74 CONDITION_VARIABLE fCondition;
75 #endif
76 };
77
78 #endif
OLDNEW
« no previous file with comments | « gyp/utils.gypi ('k') | include/utils/SkRunnable.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698