-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.cpp
40 lines (31 loc) · 869 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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#include "Generator.h"
#include "Database.h"
#include "ControlModule.h"
#include <iostream>
#include <cmath>
#include <exception>
#include <memory>
#include <thread>
#include <future>
int main() {
try {
SharedParameters prms;
CommunicationPipe comm;
Database db(&prms);
ControlModule cm(&prms);
RandomMode rand_mode(1, &prms);
ReadingMode read_mode(10, &prms);
Generator generator(rand_mode, &prms);
generator.addMode(read_mode);
std::thread t1(&Generator::run, &generator, std::ref(comm));
std::thread t2(&Database::processSequence, &db, std::ref(comm));
std::thread t3(&ControlModule::processInput, &cm,std::ref(generator));
t1.join();
t2.join();
t3.join();
}
catch (std::exception& e) {
std::cerr << e.what() << std::endl;
}
return 0;
}