Module: ThreadSafe::Util::CheapLockable
- Extended by:
- Volatile
- Included in:
- AtomicReferenceCacheBackend::Node
- Defined in:
- lib/thread_safe/util/cheap_lockable.rb
Overview
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