module Concurrent::ThreadSafe::Util::CheapLockable
Provides a cheapest possible (mainly in terms of memory usage) Mutex
with the ConditionVariable
bundled in.
Usage:
class A include CheapLockable def do_exlusively cheap_synchronize { yield } end def wait_for_something cheap_synchronize do cheap_wait until resource_available? do_something cheap_broadcast # wake up others end end end
@!visibility private
Private Instance Methods
cheap_broadcast()
click to toggle source
# File lib/concurrent-ruby/concurrent/thread_safe/util/cheap_lockable.rb, line 48 def cheap_broadcast JRuby.reference0(self).notify_all end
cheap_synchronize() { || ... }
click to toggle source
# File lib/concurrent-ruby/concurrent/thread_safe/util/cheap_lockable.rb, line 40 def cheap_synchronize JRuby.reference0(self).synchronized { yield } end
cheap_wait()
click to toggle source
# File lib/concurrent-ruby/concurrent/thread_safe/util/cheap_lockable.rb, line 44 def cheap_wait JRuby.reference0(self).wait end