-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy paththread_info.cpp
More file actions
42 lines (33 loc) · 899 Bytes
/
Copy paththread_info.cpp
File metadata and controls
42 lines (33 loc) · 899 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
32
33
34
35
36
37
38
39
40
41
42
//
// Created by michal on 26.09.17.
//
#include "thread_info.h"
int threads_number = 0;
void ThreadInfo::set_executed_bit(int new_executed_bit) {
executed_bit = new_executed_bit;
}
void ThreadInfo::operator()() {
execution();
}
void ThreadInfo::process_function() {
std::cout << "Enter thread " << threads_number << std::endl;
executor.reset();
executor.set_actual_bit(executed_bit);
executor.process_instruction();
set_executed_bit(executor.get_actual_bit());
std::cout << "Exit thread " << threads_number << std::endl;
}
void ThreadInfo::execution() {
do {
process_function();
} while (!check_thread_end());
}
void ThreadInfo::set_thread_id(std::thread::id new_thread_id) {
thread_id = new_thread_id;
}
std::thread::id ThreadInfo::get_thread_id() {
return thread_id;
}
bool ThreadInfo::check_thread_end() {
return thread_end;
}