-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlinker.cpp
32 lines (26 loc) · 872 Bytes
/
linker.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
#include "./linker.h"
Linker* Linker::instance = NULL;
Linker* Linker::get_instance() {
if (instance == NULL) {
instance = new Linker();
}
return instance;
}
void Linker::give_command(int _command) {
std::lock_guard <std::mutex> guard(Linker::get_instance()->command_mutex);
Linker::get_instance()->command = _command;
}
// you are not allowed to call this funciton
int Linker::get_command() {
std::lock_guard <std::mutex> guard(Linker::get_instance()->command_mutex);
return Linker::get_instance()->command;
}
// you are not allowed to call this funciton
void Linker::give_error(double _error) {
std::lock_guard <std::mutex> guard(Linker::get_instance()->error_mutex);
Linker::get_instance()->error = _error;
}
double Linker::get_error() {
std::lock_guard <std::mutex> guard(Linker::get_instance()->error_mutex);
return Linker::get_instance()->error;
}