From 2a19c63448c84c1805fb1a585c3651318bb86ca7 Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Tue, 28 Aug 2018 15:28:34 +0200 Subject: BASELINE: Update Chromium to 69.0.3497.70 Change-Id: I2b7b56e4e7a8b26656930def0d4575dc32b900a0 Reviewed-by: Allan Sandfeld Jensen --- gn/util/worker_pool.h | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 gn/util/worker_pool.h (limited to 'gn/util/worker_pool.h') diff --git a/gn/util/worker_pool.h b/gn/util/worker_pool.h new file mode 100644 index 00000000000..d0616449097 --- /dev/null +++ b/gn/util/worker_pool.h @@ -0,0 +1,37 @@ +// Copyright 2018 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef UTIL_WORKER_POOL_H_ +#define UTIL_WORKER_POOL_H_ + +#include +#include +#include +#include + +#include "base/logging.h" +#include "base/macros.h" +#include "util/task.h" + +class WorkerPool { + public: + WorkerPool(); + WorkerPool(size_t thread_count); + ~WorkerPool(); + + void PostTask(Task work); + + private: + void Worker(); + + std::vector threads_; + std::queue task_queue_; + std::mutex queue_mutex_; + std::condition_variable_any pool_notifier_; + bool should_stop_processing_; + + DISALLOW_COPY_AND_ASSIGN(WorkerPool); +}; + +#endif // UTIL_WORKER_POOL_H_ -- cgit v1.2.1