Skip to content

Commit

Permalink
thread.c: Mutex#synchronize no block params
Browse files Browse the repository at this point in the history
* thread.c (rb_mutex_synchronize_m): yield no block params.  patch by
  splattael (Peter Suschlik) in [ruby-core:53773] [Bug #8097].
  fix GH-266.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40000 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
  • Loading branch information
nobu committed Mar 29, 2013
1 parent 2418b20 commit 99155e2
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
6 changes: 6 additions & 0 deletions ChangeLog
Original file line number Original file line Diff line number Diff line change
@@ -1,3 +1,9 @@
Fri Mar 29 22:09:46 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>

* 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@ruby-lang.org> Fri Mar 29 16:51:39 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>


* io.c (argf_next_argv): set init flag if succeeded to forward, after * io.c (argf_next_argv): set init flag if succeeded to forward, after
Expand Down
5 changes: 5 additions & 0 deletions test/ruby/test_thread.rb
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -120,6 +120,11 @@ def test_mutex_synchronize
assert_equal(max * max * max, r) assert_equal(max * max * max, r)
end 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 def test_local_barrier
dir = File.dirname(__FILE__) dir = File.dirname(__FILE__)
lbtest = File.join(dir, "lbtest.rb") lbtest = File.join(dir, "lbtest.rb")
Expand Down
2 changes: 1 addition & 1 deletion thread.c
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -4567,7 +4567,7 @@ rb_mutex_synchronize_m(VALUE self, VALUE args)
rb_raise(rb_eThreadError, "must be called with a block"); 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) void rb_mutex_allow_trap(VALUE self, int val)
Expand Down

0 comments on commit 99155e2

Please sign in to comment.