Class

Use the Monitor class when you want to have a lock object for blocks with mutual exclusion.

require 'monitor'

lock = Monitor.new
lock.synchronize do
  # exclusive access
end
Instance Methods

Enters exclusive section.

Leaves exclusive section.

An alias for enter
An alias for exit
An alias for synchronize
An alias for try_enter

Creates a new MonitorMixin::ConditionVariable associated with the Monitor object.

Enters exclusive section and executes the block. Leaves the exclusive section automatically when the block exits. See example under MonitorMixin.

Attempts to enter exclusive section. Returns false if lock fails.

An alias for try_enter