aboutsummaryrefslogtreecommitdiffhomepage
path: root/include/utils/SkCountdown.h
diff options
context:
space:
mode:
authorGravatar scroggo@google.com <scroggo@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-10-31 15:52:16 +0000
committerGravatar scroggo@google.com <scroggo@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-10-31 15:52:16 +0000
commit4177ef4b229b5fb67f355569654981bb4bf8eb9c (patch)
tree0091c5ff6ed7dd7b89e73f9b11cde51e700c5726 /include/utils/SkCountdown.h
parent72ba668db833d25ecdca4edfbefd601e508a1e62 (diff)
Add SkThreadPool for managing threads.
Skia-ized from https://codereview.appspot.com/6755043/ TODO: Use SkThread and platform independent features. Review URL: https://codereview.appspot.com/6777064 git-svn-id: http://skia.googlecode.com/svn/trunk@6217 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'include/utils/SkCountdown.h')
-rw-r--r--include/utils/SkCountdown.h36
1 files changed, 36 insertions, 0 deletions
diff --git a/include/utils/SkCountdown.h b/include/utils/SkCountdown.h
new file mode 100644
index 0000000000..6bcec7d5ff
--- /dev/null
+++ b/include/utils/SkCountdown.h
@@ -0,0 +1,36 @@
+/*
+ * Copyright 2012 Google Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#ifndef SkCountdown_DEFINED
+#define SkCountdown_DEFINED
+
+#include "SkCondVar.h"
+#include "SkRunnable.h"
+#include "SkTypes.h"
+
+class SkCountdown : public SkRunnable {
+public:
+ explicit SkCountdown(int32_t count);
+
+ /**
+ * Resets the countdown to the count provided.
+ */
+ void reset(int32_t count);
+
+ virtual void run() SK_OVERRIDE;
+
+ /**
+ * Blocks until run() has been called count times.
+ */
+ void wait();
+
+private:
+ SkCondVar fReady;
+ int32_t fCount;
+};
+
+#endif