-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSystem.cpp
More file actions
60 lines (46 loc) · 1.29 KB
/
System.cpp
File metadata and controls
60 lines (46 loc) · 1.29 KB
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#include "System.h"
Shutdown* _shutdown = new Shutdown();
Counter* _counter = new Counter();
Vectors* vectorObjectContainer = new Vectors();
LogQueue queueObjectContainer(*_shutdown, *_counter);
std::mutex _mu;
std::condition_variable _cv;
void System::run() {
srand(static_cast<unsigned int>(time(NULL)));
{
std::unique_lock<std::mutex> _rLock(_mu);
for (auto i : { 'S','y','s','t','e','m',' ','i','s',' ','R','u','n','n','i','n','g','.','.','.' }) {
printChar(i);
std::this_thread::sleep_for(50ms);
}
pressToContinue();
_cv.notify_all();
}
ATHREAD_t threadS001([&] {
while (!_shutdown->getShutdownState()) {
text_t newLog = vectorObjectContainer->generateLog();
queueObjectContainer.pushGeneratedLogs(newLog);
std::this_thread::sleep_for(1000ms);
}
});
ATHREAD_t threadS002([&] {
verticalPadding();
{
std::unique_lock<std::mutex> _rLock(_mu);
text_t headerMessage = (horizontalPadding() + "Registered Logs...");
printMessage(headerMessage, 5);
_cv.notify_all();
}
while (!_shutdown->getShutdownState())
{
queueObjectContainer.popGeneratedLogs();
}
pressToContinue();
});
/*ATHREAD_t threadS003([&] {
queueObjectContainer.showLogRegistration();
});*/
threadS001.join();
threadS002.join();
/*threadS003.join();*/
}