summaryrefslogtreecommitdiff
path: root/process.c
diff options
context:
space:
mode:
authorshyouhei <shyouhei@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-09-07 06:42:50 +0000
committershyouhei <shyouhei@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-09-07 06:42:50 +0000
commit0c56b5e4a8a99b15239ed98ef5c606aa7efdd95b (patch)
tree7eff1bcd72013a933552f6224798728a25984949 /process.c
parentb65958153c553fa23420fc7262589e18baef2e52 (diff)
* process.c (detach_process_watcher): should not pass the pointer
to an auto variable to the thread to be created. pointed and fix by KUBO Takehiro <kubo at jiubao.org> [ruby-dev:30618] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8_6@13383 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'process.c')
-rw-r--r--process.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/process.c b/process.c
index 624aeaefc88..1cfb9ceade6 100644
--- a/process.c
+++ b/process.c
@@ -848,23 +848,22 @@ proc_waitall()
}
static VALUE
-detach_process_watcher(pid_p)
- int *pid_p;
+detach_process_watcher(arg)
+ void *arg;
{
- int cpid, status;
+ int pid = (int)arg, status;
- for (;;) {
- cpid = rb_waitpid(*pid_p, &status, WNOHANG);
- if (cpid != 0) return Qnil;
+ while (rb_waitpid(pid, &status, WNOHANG) == 0) {
rb_thread_sleep(1);
}
+ return Qnil;
}
VALUE
rb_detach_process(pid)
int pid;
{
- return rb_thread_create(detach_process_watcher, (void*)&pid);
+ return rb_thread_create(detach_process_watcher, (void*)pid);
}