From 0c56b5e4a8a99b15239ed98ef5c606aa7efdd95b Mon Sep 17 00:00:00 2001 From: shyouhei Date: Fri, 7 Sep 2007 06:42:50 +0000 Subject: * 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 [ruby-dev:30618] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8_6@13383 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 6 ++++++ process.c | 13 ++++++------- version.h | 2 +- 3 files changed, 13 insertions(+), 8 deletions(-) diff --git a/ChangeLog b/ChangeLog index 81983c8c02..efe27c7e53 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +Fri Sep 7 15:42:07 2007 Nobuyoshi Nakada + + * 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 [ruby-dev:30618] + Fri Sep 7 15:40:47 2007 Nobuyoshi Nakada * sample/test.rb, test/ruby/test_system.rb(valid_syntax?): keep diff --git a/process.c b/process.c index 624aeaefc8..1cfb9ceade 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); } diff --git a/version.h b/version.h index 2608567e75..43c118af2f 100644 --- a/version.h +++ b/version.h @@ -2,7 +2,7 @@ #define RUBY_RELEASE_DATE "2007-09-07" #define RUBY_VERSION_CODE 186 #define RUBY_RELEASE_CODE 20070907 -#define RUBY_PATCHLEVEL 91 +#define RUBY_PATCHLEVEL 92 #define RUBY_VERSION_MAJOR 1 #define RUBY_VERSION_MINOR 8 -- cgit v1.2.3