ruby-changes:27948
From: nobu <ko1@a...>
Date: Fri, 29 Mar 2013 22:10:02 +0900 (JST)
Subject: [ruby-changes:27948] nobu:r40000 (trunk): thread.c: Mutex#synchronize no block params
nobu 2013-03-29 22:09:52 +0900 (Fri, 29 Mar 2013) New Revision: 40000 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=40000 Log: thread.c: Mutex#synchronize no block params * thread.c (rb_mutex_synchronize_m): yield no block params. patch by splattael (Peter Suschlik) in [ruby-core:53773] [Bug #8097]. fix GH-266. Modified files: trunk/ChangeLog trunk/test/ruby/test_thread.rb trunk/thread.c Index: ChangeLog =================================================================== --- ChangeLog (revision 39999) +++ ChangeLog (revision 40000) @@ -1,3 +1,9 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1 +Fri Mar 29 22:09:46 2013 Nobuyoshi Nakada <nobu@r...> + + * thread.c (rb_mutex_synchronize_m): yield no block params. patch by + splattael (Peter Suschlik) in [ruby-core:53773] [Bug #8097]. + fix GH-266. + Fri Mar 29 16:51:39 2013 Nobuyoshi Nakada <nobu@r...> * io.c (argf_next_argv): set init flag if succeeded to forward, after Index: thread.c =================================================================== --- thread.c (revision 39999) +++ thread.c (revision 40000) @@ -4567,7 +4567,7 @@ rb_mutex_synchronize_m(VALUE self, VALUE https://github.com/ruby/ruby/blob/trunk/thread.c#L4567 rb_raise(rb_eThreadError, "must be called with a block"); } - return rb_mutex_synchronize(self, rb_yield, Qnil); + return rb_mutex_synchronize(self, rb_yield, Qundef); } void rb_mutex_allow_trap(VALUE self, int val) Index: test/ruby/test_thread.rb =================================================================== --- test/ruby/test_thread.rb (revision 39999) +++ test/ruby/test_thread.rb (revision 40000) @@ -120,6 +120,11 @@ class TestThread < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_thread.rb#L120 assert_equal(max * max * max, r) end + def test_mutex_synchronize_yields_no_block_params + bug8097 = '[ruby-core:53424] [Bug #8097]' + assert_empty(Mutex.new.synchronize {|*params| break params}, bug8097) + end + def test_local_barrier dir = File.dirname(__FILE__) lbtest = File.join(dir, "lbtest.rb") -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/