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

ruby-changes:30847

From: nagachika <ko1@a...>
Date: Fri, 13 Sep 2013 02:11:57 +0900 (JST)
Subject: [ruby-changes:30847] nagachika:r42926 (ruby_2_0_0): merge revision(s) 42906: [Backport #8891]

nagachika	2013-09-13 02:11:50 +0900 (Fri, 13 Sep 2013)

  New Revision: 42926

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

  Log:
    merge revision(s) 42906: [Backport #8891]
    
    * thread.c (rb_mutex_unlock): Mutex#unlock no longer raise
      an exception even if uses on trap. [Bug #8891]

  Modified directories:
    branches/ruby_2_0_0/
  Modified files:
    branches/ruby_2_0_0/ChangeLog
    branches/ruby_2_0_0/test/ruby/test_thread.rb
    branches/ruby_2_0_0/thread.c
    branches/ruby_2_0_0/version.h
Index: ruby_2_0_0/ChangeLog
===================================================================
--- ruby_2_0_0/ChangeLog	(revision 42925)
+++ ruby_2_0_0/ChangeLog	(revision 42926)
@@ -1,3 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/ChangeLog#L1
+Fri Sep 13 01:44:54 2013  KOSAKI Motohiro  <kosaki.motohiro@g...>
+
+	* thread.c (rb_mutex_unlock): Mutex#unlock no longer raise
+	  an exception even if uses on trap. [Bug #8891]
+
 Fri Sep 13 01:09:59 2013  Shota Fukumori  <sorah@t...>
 
 	* vm_backtrace.c (vm_backtrace_to_ary): Ignore the second argument if
Index: ruby_2_0_0/thread.c
===================================================================
--- ruby_2_0_0/thread.c	(revision 42925)
+++ ruby_2_0_0/thread.c	(revision 42926)
@@ -4425,11 +4425,6 @@ rb_mutex_unlock(VALUE self) https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/thread.c#L4425
     rb_mutex_t *mutex;
     GetMutexPtr(self, mutex);
 
-    /* When running trap handler */
-    if (!mutex->allow_trap && GET_THREAD()->interrupt_mask & TRAP_INTERRUPT_MASK) {
-	rb_raise(rb_eThreadError, "can't be called from trap context");
-    }
-
     err = rb_mutex_unlock_th(mutex, GET_THREAD());
     if (err) rb_raise(rb_eThreadError, "%s", err);
 
Index: ruby_2_0_0/version.h
===================================================================
--- ruby_2_0_0/version.h	(revision 42925)
+++ ruby_2_0_0/version.h	(revision 42926)
@@ -1,6 +1,6 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/version.h#L1
 #define RUBY_VERSION "2.0.0"
 #define RUBY_RELEASE_DATE "2013-09-13"
-#define RUBY_PATCHLEVEL 308
+#define RUBY_PATCHLEVEL 309
 
 #define RUBY_RELEASE_YEAR 2013
 #define RUBY_RELEASE_MONTH 9
Index: ruby_2_0_0/test/ruby/test_thread.rb
===================================================================
--- ruby_2_0_0/test/ruby/test_thread.rb	(revision 42925)
+++ ruby_2_0_0/test/ruby/test_thread.rb	(revision 42926)
@@ -877,6 +877,23 @@ Thread.new(Thread.current) {|mth| https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/test/ruby/test_thread.rb#L877
     end
   end
 
+  def test_mutex_unlock_on_trap
+    assert_in_out_err([], <<-INPUT, %w(locked unlocked false), [])
+      m = Mutex.new
+
+      Signal.trap("INT") { |signo|
+        m.unlock
+        puts "unlocked"
+      }
+
+      m.lock
+      puts "locked"
+      Process.kill("INT", $$)
+      sleep 0.01
+      puts m.locked?
+    INPUT
+  end
+
   def invoke_rec script, vm_stack_size, machine_stack_size, use_length = true
     env = {}
     env['RUBY_THREAD_VM_STACK_SIZE'] = vm_stack_size.to_s if vm_stack_size

Property changes on: ruby_2_0_0
___________________________________________________________________
Modified: svn:mergeinfo
   Merged /trunk:r42906


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

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