class RSpec::Support::ReentrantMutex

Allows a thread to lock out other threads from a critical section of code, while allowing the thread with the lock to reenter that section.

Based on Monitor as of 2.2 - github.com/ruby/ruby/blob/eb7ddaa3a47bf48045d26c72eb0f263a53524ebc/lib/monitor.rb#L9

@private

Public Class Methods

# File rspec-support/lib/rspec/support/reentrant_mutex.rb, line 21
def initialize
  @owner = nil
  @count = 0
  @mutex = Mutex.new
end

Public Instance Methods

# File rspec-support/lib/rspec/support/reentrant_mutex.rb, line 27
def synchronize
  enter
  yield
ensure
  exit
end