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

Unified Diff: include/utils/SkThreadPool.h

Issue 26389005: SkThreadPool: allow for Runnables that add other Runnables to the pool. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 7 years, 2 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | src/utils/SkThreadPool.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include/utils/SkThreadPool.h
diff --git a/include/utils/SkThreadPool.h b/include/utils/SkThreadPool.h
index 6cb8b528d316624bb388b22b09eea132178fc251..0aa7c08ad53b6e48d8f82ce61b95dca36fdc679e 100644
--- a/include/utils/SkThreadPool.h
+++ b/include/utils/SkThreadPool.h
@@ -45,10 +45,17 @@ public:
SK_DECLARE_INTERNAL_LLIST_INTERFACE(LinkedRunnable);
};
- SkTInternalLList<LinkedRunnable> fQueue;
- SkCondVar fReady;
- SkTDArray<SkThread*> fThreads;
- bool fDone;
+ enum State {
+ kRunning_State, // Normal case. We've been constructed and no one has called wait().
+ kWaiting_State, // wait has been called, but there still might be work to do or being done.
+ kHalting_State, // There's no work to do and no thread is busy. All threads can shut down.
+ };
+
+ SkTInternalLList<LinkedRunnable> fQueue;
+ SkCondVar fReady;
+ SkTDArray<SkThread*> fThreads;
+ State fState;
+ int fBusyThreads;
static void Loop(void*); // Static because we pass in this.
};
« no previous file with comments | « no previous file | src/utils/SkThreadPool.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698