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

ruby-changes:37752

From: nobu <ko1@a...>
Date: Wed, 4 Mar 2015 00:45:16 +0900 (JST)
Subject: [ruby-changes:37752] nobu:r49833 (trunk): thread.c: volatile inside EXEC_TAG

nobu	2015-03-04 00:45:00 +0900 (Wed, 04 Mar 2015)

  New Revision: 49833

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

  Log:
    thread.c: volatile inside EXEC_TAG
    
    * thread.c (rb_thread_io_blocking_region): assigned variables
      inside EXEC_TAG() should be volatile.
    * thread.c (rb_thread_s_handle_interrupt): ditto.
    * thread.c (exec_recursive): ditto.

  Modified files:
    trunk/ChangeLog
    trunk/thread.c
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 49832)
+++ ChangeLog	(revision 49833)
@@ -1,3 +1,12 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Wed Mar  4 00:44:56 2015  Nobuyoshi Nakada  <nobu@r...>
+
+	* thread.c (rb_thread_io_blocking_region): assigned variables
+	  inside EXEC_TAG() should be volatile.
+
+	* thread.c (rb_thread_s_handle_interrupt): ditto.
+
+	* thread.c (exec_recursive): ditto.
+
 Wed Mar  4 00:29:18 2015  NAKAMURA Usaku  <usa@r...>
 
 	* tool/redmine-backporter.rb: now can specify shorten form of commands.
Index: thread.c
===================================================================
--- thread.c	(revision 49832)
+++ thread.c	(revision 49833)
@@ -1386,9 +1386,9 @@ rb_thread_call_without_gvl(void *(*func) https://github.com/ruby/ruby/blob/trunk/thread.c#L1386
 VALUE
 rb_thread_io_blocking_region(rb_blocking_function_t *func, void *data1, int fd)
 {
-    VALUE val = Qundef; /* shouldn't be used */
+    volatile VALUE val = Qundef; /* shouldn't be used */
     rb_thread_t *th = GET_THREAD();
-    int saved_errno = 0;
+    volatile int saved_errno = 0;
     int state;
 
     th->waiting_fd = fd;
@@ -1787,7 +1787,7 @@ rb_thread_s_handle_interrupt(VALUE self, https://github.com/ruby/ruby/blob/trunk/thread.c#L1787
 {
     VALUE mask;
     rb_thread_t *th = GET_THREAD();
-    VALUE r = Qnil;
+    volatile VALUE r = Qnil;
     int state;
 
     if (!rb_block_given_p()) {
@@ -4859,10 +4859,11 @@ exec_recursive(VALUE (*func) (VALUE, VAL https://github.com/ruby/ruby/blob/trunk/thread.c#L4859
 	    }
 	}
 	else {
+	    volatile VALUE ret = Qundef;
 	    recursive_push(p.list, p.objid, p.pairid);
 	    PUSH_TAG();
 	    if ((state = EXEC_TAG()) == 0) {
-		result = (*func)(obj, arg, FALSE);
+		ret = (*func)(obj, arg, FALSE);
 	    }
 	    POP_TAG();
 	    if (!recursive_pop(p.list, p.objid, p.pairid)) {
@@ -4872,6 +4873,7 @@ exec_recursive(VALUE (*func) (VALUE, VAL https://github.com/ruby/ruby/blob/trunk/thread.c#L4873
 			 sym, rb_thread_current());
 	    }
 	    if (state) JUMP_TAG(state);
+	    result = ret;
 	}
     }
     *(volatile struct exec_recursive_params *)&p;

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

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