[前][次][番号順一覧][スレッド一覧]

ruby-changes:1868

From: ko1@a...
Date: 7 Sep 2007 14:03:59 +0900
Subject: [ruby-changes:1868] shyouhei - Ruby:r13359 (ruby_1_8_5): * process.c (detach_process_watcher): should not pass the pointer

shyouhei	2007-09-07 14:03:51 +0900 (Fri, 07 Sep 2007)

  New Revision: 13359

  Modified files:
    branches/ruby_1_8_5/ChangeLog
    branches/ruby_1_8_5/process.c
    branches/ruby_1_8_5/version.h

  Log:
    * 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]


  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/branches/ruby_1_8_5/process.c?r1=13359&r2=13358
  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/branches/ruby_1_8_5/version.h?r1=13359&r2=13358
  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/branches/ruby_1_8_5/ChangeLog?r1=13359&r2=13358

Index: ruby_1_8_5/process.c
===================================================================
--- ruby_1_8_5/process.c	(revision 13358)
+++ ruby_1_8_5/process.c	(revision 13359)
@@ -848,23 +848,22 @@
 }
 
 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);
 }
 
 
Index: ruby_1_8_5/ChangeLog
===================================================================
--- ruby_1_8_5/ChangeLog	(revision 13358)
+++ ruby_1_8_5/ChangeLog	(revision 13359)
@@ -1,3 +1,9 @@
+Fri Sep  7 14:02:10 2007  Nobuyoshi Nakada  <nobu@r...>
+
+	* 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]
+
 Fri Sep  7 13:52:36 2007  Tanaka Akira  <akr@f...>
 
 	* bignum.c (big_lshift): make shift offset long type.
Index: ruby_1_8_5/version.h
===================================================================
--- ruby_1_8_5/version.h	(revision 13358)
+++ ruby_1_8_5/version.h	(revision 13359)
@@ -2,7 +2,7 @@
 #define RUBY_RELEASE_DATE "2007-09-07"
 #define RUBY_VERSION_CODE 185
 #define RUBY_RELEASE_CODE 20070907
-#define RUBY_PATCHLEVEL 99
+#define RUBY_PATCHLEVEL 100
 
 #define RUBY_VERSION_MAJOR 1
 #define RUBY_VERSION_MINOR 8

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml

[前][次][番号順一覧][スレッド一覧]