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

ruby-changes:15708

From: wanabe <ko1@a...>
Date: Wed, 5 May 2010 20:53:18 +0900 (JST)
Subject: [ruby-changes:15708] Ruby:r27630 (trunk): * thread_win32.c (w32_wait_events): get GVL before handle interrupt

wanabe	2010-05-05 20:53:03 +0900 (Wed, 05 May 2010)

  New Revision: 27630

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

  Log:
    * thread_win32.c (w32_wait_events): get GVL before handle interrupt
      event.   [ruby-core:27199], [ruby-core:29698]

  Modified files:
    trunk/ChangeLog
    trunk/thread_win32.c

Index: thread_win32.c
===================================================================
--- thread_win32.c	(revision 27629)
+++ thread_win32.c	(revision 27630)
@@ -103,16 +103,20 @@
     thread_debug("  w32_wait_events events:%p, count:%d, timeout:%ld, th:%p\n",
 		 events, count, timeout, th);
     if (th && (intr = th->native_thread_data.interrupt_event)) {
-	w32_reset_event(intr);
-	if (RUBY_VM_INTERRUPTED(th)) {
-	    w32_set_event(intr);
-	}
+	native_mutex_lock(&th->vm->global_vm_lock);
+	if (intr == th->native_thread_data.interrupt_event) {
+	    w32_reset_event(intr);
+	    if (RUBY_VM_INTERRUPTED(th)) {
+		w32_set_event(intr);
+	    }
 
-	targets = ALLOCA_N(HANDLE, count + 1);
-	memcpy(targets, events, sizeof(HANDLE) * count);
+	    targets = ALLOCA_N(HANDLE, count + 1);
+	    memcpy(targets, events, sizeof(HANDLE) * count);
 
-	targets[count++] = intr;
-	thread_debug("  * handle: %p (count: %d, intr)\n", intr, count);
+	    targets[count++] = intr;
+	    thread_debug("  * handle: %p (count: %d, intr)\n", intr, count);
+	}
+	native_mutex_unlock(&th->vm->global_vm_lock);
     }
 
     thread_debug("  WaitForMultipleObjects start (count: %d)\n", count);
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 27629)
+++ ChangeLog	(revision 27630)
@@ -1,3 +1,8 @@
+Wed May  5 20:37:54 2010  wanabe  <s.wanabe@g...>
+
+	* thread_win32.c (w32_wait_events): get GVL before handle interrupt
+	  event.   [ruby-core:27199], [ruby-core:29698]
+
 Wed May  5 19:00:01 2010  Hidetoshi NAGAI  <nagai@a...>
 
 	* ext/tk/extconf.rb: revert. enbugged by last commit.

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

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