ruby-changes:49347
From: nobu <ko1@a...>
Date: Mon, 25 Dec 2017 12:25:51 +0900 (JST)
Subject: [ruby-changes:49347] nobu:r61462 (trunk): prelude.rb: block passing
nobu 2017-12-25 12:25:45 +0900 (Mon, 25 Dec 2017) New Revision: 61462 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=61462 Log: prelude.rb: block passing * prelude.rb (Thread.exclusive): pass the block as a block argument. Modified files: trunk/prelude.rb Index: prelude.rb =================================================================== --- prelude.rb (revision 61461) +++ prelude.rb (revision 61462) @@ -8,11 +8,9 @@ class Thread https://github.com/ruby/ruby/blob/trunk/prelude.rb#L8 # Wraps the block in a single, VM-global Mutex.synchronize, returning the # value of the block. A thread executing inside the exclusive section will # only block other threads which also use the Thread.exclusive mechanism. - def self.exclusive + def self.exclusive(&block) warn "Thread.exclusive is deprecated, use Thread::Mutex", caller - MUTEX_FOR_THREAD_EXCLUSIVE.synchronize{ - yield - } + MUTEX_FOR_THREAD_EXCLUSIVE.synchronize(&block) end end -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/