diff options
Diffstat (limited to 'runtime/thread_pool.h')
-rw-r--r-- | runtime/thread_pool.h | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/runtime/thread_pool.h b/runtime/thread_pool.h index fee009b7c0..f55d72ec30 100644 --- a/runtime/thread_pool.h +++ b/runtime/thread_pool.h @@ -129,6 +129,12 @@ class ThreadPool { size_t worker_stack_size = ThreadPoolWorker::kDefaultStackSize); virtual ~ThreadPool(); + // Create the threads of this pool. + void CreateThreads(); + + // Stops and deletes all threads in this pool. + void DeleteThreads(); + // Wait for all tasks currently on queue to get completed. If the pool has been stopped, only // wait till all already running tasks are done. // When the pool was created with peers for workers, do_work must not be true (see ThreadPool()). @@ -174,7 +180,6 @@ class ThreadPool { // How many worker threads are waiting on the condition. volatile size_t waiting_count_ GUARDED_BY(task_queue_lock_); std::deque<Task*> tasks_ GUARDED_BY(task_queue_lock_); - // TODO: make this immutable/const? std::vector<ThreadPoolWorker*> threads_; // Work balance detection. uint64_t start_time_ GUARDED_BY(task_queue_lock_); @@ -182,6 +187,7 @@ class ThreadPool { Barrier creation_barier_; size_t max_active_workers_ GUARDED_BY(task_queue_lock_); const bool create_peers_; + const size_t worker_stack_size_; private: friend class ThreadPoolWorker; |