diff options
author | Tom Smeding <tom.smeding@gmail.com> | 2018-08-20 23:51:16 +0200 |
---|---|---|
committer | Tom Smeding <tom.smeding@gmail.com> | 2018-08-20 23:52:03 +0200 |
commit | 57a1091dfb2c6403cbe63c7ddca8acc7e3d0f940 (patch) | |
tree | a997ed523a853d9d5fff7d5b90b12a180b00a231 /competition/job.h | |
parent | f0b6d1b9c46578183b427bcec4bbe99ab10c7b97 (diff) |
Diffstat (limited to 'competition/job.h')
-rw-r--r-- | competition/job.h | 39 |
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(); -}; |