1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* 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@13101 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2007-08-18 06:59:54 +00:00
parent 2e752da616
commit b9d4e5e742
2 changed files with 12 additions and 7 deletions

View file

@ -1,3 +1,9 @@
Sat Aug 18 15:59:52 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
* 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]
Sat Aug 18 12:24:30 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
* sample/test.rb, test/ruby/test_system.rb(valid_syntax?): keep

View file

@ -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);
}