aboutsummaryrefslogtreecommitdiff
path: root/thread_pool.cc
diff options
context:
space:
mode:
Diffstat (limited to 'thread_pool.cc')
-rw-r--r--thread_pool.cc14
1 files changed, 7 insertions, 7 deletions
diff --git a/thread_pool.cc b/thread_pool.cc
index c504ef5..0a12bfa 100644
--- a/thread_pool.cc
+++ b/thread_pool.cc
@@ -14,13 +14,13 @@
#include "thread_pool.h"
+#include <condition_variable>
+#include <mutex>
#include <stack>
+#include <thread>
#include <vector>
#include "affinity.h"
-#include "condvar.h"
-#include "mutex.h"
-#include "thread.h"
class ThreadPoolImpl : public ThreadPool {
public:
@@ -37,14 +37,14 @@ class ThreadPoolImpl : public ThreadPool {
}
virtual void Submit(function<void(void)> task) override {
- UniqueLock<Mutex> lock(mu_);
+ unique_lock<mutex> lock(mu_);
tasks_.push(task);
cond_.notify_one();
}
virtual void Wait() override {
{
- UniqueLock<Mutex> lock(mu_);
+ unique_lock<mutex> lock(mu_);
is_waiting_ = true;
cond_.notify_all();
}
@@ -61,7 +61,7 @@ class ThreadPoolImpl : public ThreadPool {
while (true) {
function<void(void)> task;
{
- UniqueLock<Mutex> lock(mu_);
+ unique_lock<mutex> lock(mu_);
if (tasks_.empty()) {
if (is_waiting_)
return;
@@ -79,7 +79,7 @@ class ThreadPoolImpl : public ThreadPool {
}
vector<thread> threads_;
- Mutex mu_;
+ mutex mu_;
condition_variable cond_;
stack<function<void(void)>> tasks_;
bool is_waiting_;