summaryrefslogtreecommitdiff
path: root/competition/job.h
diff options
context:
space:
mode:
Diffstat (limited to 'competition/job.h')
-rw-r--r--competition/job.h39
1 files changed, 0 insertions, 39 deletions
diff --git a/competition/job.h b/competition/job.h
deleted file mode 100644
index 9dba159..0000000
--- a/competition/job.h
+++ /dev/null
@@ -1,39 +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 terminateFlag = false;
- mutex commMut;
-
- vector<thread> workers;
-
- void workerEntry();
-
-public:
- const int nthreads;
-
- Scheduler(int nthreads);
- ~Scheduler();
-
- // func is run in child thread
- // doneCallback is run in host thread
- void submit(const function<void()> &func);
-
- void finish();
-};