-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathprocessing.cpp
More file actions
31 lines (25 loc) · 1011 Bytes
/
Copy pathprocessing.cpp
File metadata and controls
31 lines (25 loc) · 1011 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
// __ _ __ __ ____
// ____/ /___ _____ (_)__ / /___ ___ ___ / /_ / / /_ ___ _____
// / __ / __ `/ __ \/ / _ \/ / __ `__ \/ _ \/ __ \/ / __ \/ _ \/ ___/
// / /_/ / /_/ / / / / / __/ / / / / / / __/ / / / / /_/ / __/ /
// \__,_/\__,_/_/ /_/_/\___/_/_/ /_/ /_/\___/_/ /_/_/_.___/\___/_/
// https://github.com/danielmehlber
#include "processing.h"
void process::start(){
run();
process_organizer::current_process_count--;
delete this;
}
process::process(){
while(process_organizer::current_process_count >= process_organizer::max_process_count);
process_organizer::current_process_count++;
std::thread th(&process::start, this);
th.detach();
}
void process_organizer::wait() {
while (!all_finished());
}
process::~process() {
}
size_t process_organizer::max_process_count = std::thread::hardware_concurrency();
size_t process_organizer::current_process_count = 0;