summaryrefslogtreecommitdiff
path: root/job.h
diff options
context:
space:
mode:
Diffstat (limited to 'job.h')
-rw-r--r--job.h40
1 files changed, 0 insertions, 40 deletions
diff --git a/job.h b/job.h
deleted file mode 100644
index 95da7c7..0000000
--- a/job.h
+++ /dev/null
@@ -1,40 +0,0 @@
-#pragma once
-
-#include <functional>
-#include <queue>
-#include <vector>
-#include <thread>
-#include <mutex>
-
-using namespace std;
-
-
-class Scheduler {
- struct Job {
- function<void()> callback;
-
- Job(const function<void()> callback)
- : callback(callback) {}
- };
-
- queue<Job*> jobs;
- bool finishFlag = false;
- mutex commMut;
-
- bool hasJoined = false;
-
- vector<thread> workers;
-
- void workerEntry();
-
-public:
- const int nthreads;
-
- Scheduler(int nthreads);
- ~Scheduler();
-
- // func is run in child thread
- void submit(const function<void()> &func);
-
- void finish();
-};