[llvm-commits] [llvm] r84903 - /llvm/trunk/lib/System/Unix/Program.inc
Ted Kremenek
kremenek at apple.com
Thu Oct 22 15:16:17 PDT 2009
Author: kremenek
Date: Thu Oct 22 17:16:17 2009
New Revision: 84903
URL: http://llvm.org/viewvc/llvm-project?rev=84903&view=rev
Log:
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.
Modified:
llvm/trunk/lib/System/Unix/Program.inc
Modified: llvm/trunk/lib/System/Unix/Program.inc
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/System/Unix/Program.inc?rev=84903&r1=84902&r2=84903&view=diff
==============================================================================
--- llvm/trunk/lib/System/Unix/Program.inc (original)
+++ llvm/trunk/lib/System/Unix/Program.inc Thu Oct 22 17:16:17 2009
@@ -244,7 +244,7 @@
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);
More information about the llvm-commits
mailing list