Class: Monitor
Relationships & Source Files | |
Super Chains via Extension / Inclusion / Inheritance | |
Instance Chain:
self,
::MonitorMixin
|
|
Inherits: | Object |
Defined in: | lib/monitor.rb |
Overview
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 Method Summary
-
#enter
Alias for MonitorMixin#mon_enter.
-
#exit
Alias for MonitorMixin#mon_exit.
-
#try_enter
Alias for MonitorMixin#try_mon_enter.
::MonitorMixin - Included
#mon_enter | Enters exclusive section. |
#mon_exit | Leaves exclusive section. |
#mon_synchronize | Enters exclusive section and executes the block. |
#mon_try_enter | Attempts to enter exclusive section. |
#new_cond | Creates a new ::MonitorMixin::ConditionVariable associated with the receiver. |
#synchronize | Alias for MonitorMixin#mon_synchronize. |
#try_mon_enter | Alias for MonitorMixin#mon_try_enter. |
#initialize | Use |
#mon_check_owner, #mon_enter_for_cond, #mon_exit_for_cond, | |
#mon_initialize | Initializes the ::MonitorMixin after being included in a class or when an object has been extended with the ::MonitorMixin. |
Instance Method Details
#enter
Alias for MonitorMixin#mon_enter.
# File 'lib/monitor.rb', line 276
alias enter mon_enter
#exit
Alias for MonitorMixin#mon_exit.
# File 'lib/monitor.rb', line 277
alias exit mon_exit
#try_enter
Alias for MonitorMixin#try_mon_enter.
# File 'lib/monitor.rb', line 275
alias try_enter try_mon_enter