summaryrefslogtreecommitdiff
path: root/runtime/thread_pool.h
diff options
context:
space:
mode:
Diffstat (limited to 'runtime/thread_pool.h')
-rw-r--r--runtime/thread_pool.h10
1 files changed, 9 insertions, 1 deletions
diff --git a/runtime/thread_pool.h b/runtime/thread_pool.h
index 8c080673f9..79b57afedd 100644
--- a/runtime/thread_pool.h
+++ b/runtime/thread_pool.h
@@ -36,10 +36,18 @@ class Closure {
class Task : public Closure {
public:
- // Called when references reaches 0.
+ // Called after Closure::Run has been called.
virtual void Finalize() { }
};
+class SelfDeletingTask : public Task {
+ public:
+ virtual ~SelfDeletingTask() { }
+ virtual void Finalize() {
+ delete this;
+ }
+};
+
class ThreadPoolWorker {
public:
static const size_t kDefaultStackSize = 1 * MB;