From: Mike Harris Date: 2006-08-12T04:37:13+09:00 Subject: Re: How absurd is this? Martin DeMello wrote: > On 8/12/06, khaines@enigo.com wrote: > >> Imagine you have in a method a block. Sometimes you will want that >> block >> to be executed via a mutex.synchronize() call. And sometimes you don't >> want to synchronize. > > > I'd add a Mutex#synchronize_unless > > def method_with_a_block > @mutex.synchronize_unless(dont_lock_here()) do > puts "This block may or may not be synchronized, depending on > whether > dont_lock_here() returned true or false." > end > end > > martin > > +1