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

ruby-changes:7955

From: ko1 <ko1@a...>
Date: Tue, 23 Sep 2008 17:17:35 +0900 (JST)
Subject: [ruby-changes:7955] Ruby:r19477 (trunk): * thread.c, include/ruby/intern.h (rb_thread_interrupted): added.

ko1	2008-09-23 17:17:17 +0900 (Tue, 23 Sep 2008)

  New Revision: 19477

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=19477

  Log:
    * thread.c, include/ruby/intern.h (rb_thread_interrupted): added.
    * io.c: use VALUE of thead instead of rb_tread_t to check interrupts.

  Modified files:
    trunk/ChangeLog
    trunk/include/ruby/intern.h
    trunk/io.c
    trunk/thread.c

Index: include/ruby/intern.h
===================================================================
--- include/ruby/intern.h	(revision 19476)
+++ include/ruby/intern.h	(revision 19477)
@@ -659,6 +659,7 @@
 typedef void rb_unblock_function_t(void *);
 typedef VALUE rb_blocking_function_t(void *);
 void rb_thread_check_ints(void);
+int rb_thread_interrupted(VALUE thval);
 VALUE rb_thread_blocking_region(rb_blocking_function_t *func, void *data1,
 				rb_unblock_function_t *ubf, void *data2);
 #define RUBY_UBF_IO ((rb_unblock_function_t *)-1)
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 19476)
+++ ChangeLog	(revision 19477)
@@ -1,3 +1,9 @@
+Tue Sep 23 17:14:31 2008  Koichi Sasada  <ko1@a...>
+
+	* thread.c, include/ruby/intern.h (rb_thread_interrupted): added.
+
+	* io.c: use VALUE of thead instead of rb_tread_t to check interrupts.
+
 Tue Sep 23 17:05:14 2008  Koichi Sasada  <ko1@a...>
 
 	* class.c, vm_core.h: move decl of rb_iseq_clone() to class.c.
Index: io.c
===================================================================
--- io.c	(revision 19476)
+++ io.c	(revision 19477)
@@ -13,7 +13,6 @@
 
 #include "ruby/ruby.h"
 #include "ruby/io.h"
-#include "vm_core.h"
 #include <ctype.h>
 #include <errno.h>
 
@@ -6979,7 +6978,7 @@
     int error_no;
     const char *notimp;
     rb_fdset_t fds;
-    rb_thread_t *th;
+    VALUE th;
 };
 
 static int
@@ -7107,7 +7106,7 @@
 #endif
             if (copy_stream_wait_write(stp) == -1)
                 return -1;
-            if (RUBY_VM_INTERRUPTED(stp->th))
+            if (rb_thread_interrupted(stp->th))
                 return -1;
             goto retry_sendfile;
         }
@@ -7237,7 +7236,7 @@
         if (!use_eof)
             copy_length -= ss;
 
-        if (RUBY_VM_INTERRUPTED(stp->th))
+        if (rb_thread_interrupted(stp->th))
             return;
     }
 }
@@ -7340,7 +7339,7 @@
     rb_io_t *src_fptr = 0, *dst_fptr = 0;
     int src_fd, dst_fd;
 
-    stp->th = GET_THREAD();
+    stp->th = rb_thread_current();
 
     stp->total = 0;
 
Index: thread.c
===================================================================
--- thread.c	(revision 19476)
+++ thread.c	(revision 19477)
@@ -899,6 +899,15 @@
     return GET_THREAD()->exec_signal != 0;
 }
 
+/* This function can be called in blocking region. */
+int
+rb_thread_interrupted(VALUE thval)
+{
+    rb_thread_t *th;
+    GetThreadPtr(thval, th);
+    return RUBY_VM_INTERRUPTED(th);
+}
+
 struct timeval rb_time_timeval();
 
 void

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

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