fix(custom): exit status

pull/385/head
Alex 2019-06-11 22:09:47 +02:00
parent 3c9b533997
commit 564fdcb369
2 changed files with 9 additions and 3 deletions

View File

@ -33,7 +33,7 @@ inline int close(FILE* fp, pid_t pid) {
fclose(fp);
while (waitpid(pid, &stat, 0) == -1) {
if (errno != EINTR) {
stat = -1;
stat = 0;
break;
}
}

View File

@ -14,7 +14,10 @@ class SleeperThread {
SleeperThread(std::function<void()> func)
: thread_{[this, func] {
while (do_run_) func();
while (do_run_) {
signal_ = false;
func();
}
}} {}
SleeperThread& operator=(std::function<void()> func) {
@ -42,7 +45,10 @@ class SleeperThread {
}
auto wake_up() {
signal_ = true;
{
std::lock_guard<std::mutex> lck(mutex_);
signal_ = true;
}
condvar_.notify_all();
}