-
Notifications
You must be signed in to change notification settings - Fork 4
/
main.cpp
26 lines (23 loc) · 995 Bytes
/
main.cpp
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
#include <iostream>
#include <cstdio>
#include "processpool.h"
using namespace std;
#ifdef _WIN32
const char *worker_app = "worker.exe";
#else
const char *worker_app = "worker";
#endif
int main(int argc, char* argv[]){
ProcessPool process_pool(worker_app, 4);
process_pool.Schedule("CreateFile \"the_file.txt\"");
process_pool.Schedule("CreateFile \"the_ file.txt\"");
process_pool.Schedule("CreateFile \"the_file.txt\" \"Other file.txt\" param1 param2");
process_pool.Schedule("CreateFile \"the_file.txt\" \"Other file.txt\" param1 param2");
process_pool.Schedule("CreateFile \"the_file.txt\" \"Other file.txt\" param1 param2");
process_pool.Schedule("CreateFile \"the_file.txt\" \"Other file.txt\" param1 param2");
cout << "Main process: Waiting for tasks to finish..." << endl;
process_pool.WaitForTasksToComplete();
cout << "Main process: All tasks completed!" << endl << "Press enter to quit" << endl;
getchar();
return 0;
}