Prevent race condition when grim_reaper thread is already trying to lock while the thread is being asked to shut down
This commit is contained in:
parent
e20d8fae8c
commit
d0374812e4
1 changed files with 24 additions and 22 deletions
|
@ -199,7 +199,7 @@ void Util::Procs::grim_reaper(void *n){
|
|||
VERYHIGH_MSG("Grim reaper start");
|
||||
while (thread_handler){
|
||||
{
|
||||
tthread::lock_guard<tthread::mutex> guard(plistMutex);
|
||||
if (plistMutex.try_lock()){
|
||||
int status;
|
||||
pid_t ret = -1;
|
||||
while (ret != 0){
|
||||
|
@ -223,6 +223,8 @@ void Util::Procs::grim_reaper(void *n){
|
|||
HIGH_MSG("Child process %d exited with code %d", ret, exitcode);
|
||||
}
|
||||
}
|
||||
plistMutex.unlock();
|
||||
}
|
||||
}
|
||||
Util::sleep(500);
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue