Class: ActiveSupport::Concurrency::ThreadMonitor
- Defined in:
- lib/active_support/concurrency/thread_monitor.rb
Overview
:nodoc:
Instance Method Summary collapse
-
#initialize ⇒ ThreadMonitor
constructor
A new instance of ThreadMonitor.
- #synchronize(&block) ⇒ Object
Constructor Details
#initialize ⇒ ThreadMonitor
Returns a new instance of ThreadMonitor.
10 11 12 13 14 |
# File 'lib/active_support/concurrency/thread_monitor.rb', line 10 def initialize @owner = nil @count = 0 @mutex = Mutex.new end |
Instance Method Details
#synchronize(&block) ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/active_support/concurrency/thread_monitor.rb', line 16 def synchronize(&block) Thread.handle_interrupt(EXCEPTION_NEVER) do mon_enter begin Thread.handle_interrupt(EXCEPTION_IMMEDIATE, &block) ensure mon_exit end end end |