summaryrefslogtreecommitdiffstats
path: root/llvm
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2009-10-22 22:16:17 +0000
committerTed Kremenek <kremenek@apple.com>2009-10-22 22:16:17 +0000
commitb5cd6233b1780a0b64cb4839b1ed64defadea5a7 (patch)
tree5defa8123905e8441cfc85ad7deba53637e315d8 /llvm
parent4546d3123506be9fad18fa1132e5ea45145b2ffe (diff)
downloadbcm5719-llvm-b5cd6233b1780a0b64cb4839b1ed64defadea5a7.tar.gz
bcm5719-llvm-b5cd6233b1780a0b64cb4839b1ed64defadea5a7.zip
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
Diffstat (limited to 'llvm')
-rw-r--r--llvm/lib/System/Unix/Program.inc2
1 files changed, 1 insertions, 1 deletions
diff --git a/llvm/lib/System/Unix/Program.inc b/llvm/lib/System/Unix/Program.inc
index 56dea250a77..c52f3a88c04 100644
--- a/llvm/lib/System/Unix/Program.inc
+++ b/llvm/lib/System/Unix/Program.inc
@@ -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);
OpenPOWER on IntegriCloud