mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-12-24 20:44:51 +00:00
Use 'waitpid' instead of 'wait'. Basing Program::Wait() on 'wait()' prevents it being correct within a multithreaded context.
This address: PR 5277 (Program::Wait is unsafe to call from multiple threads). Note: If waitpid() turns out to be non-portable, we can add more autoconf magic, or look into another solution. llvm-svn: 84903
This commit is contained in:
parent
e90afea0ba
commit
b9ff937285
@ -244,7 +244,7 @@ Program::Wait(unsigned secondsToWait,
|
||||
int status;
|
||||
uint64_t pid = reinterpret_cast<uint64_t>(Data_);
|
||||
pid_t child = static_cast<pid_t>(pid);
|
||||
while (wait(&status) != child)
|
||||
while (waitpid(pid, &status, 0) != child)
|
||||
if (secondsToWait && errno == EINTR) {
|
||||
// Kill the child.
|
||||
kill(child, SIGKILL);
|
||||
|
Loading…
Reference in New Issue
Block a user