Method: Arrow::Session::Lock#with_read_lock

Defined in:
lib/arrow/session/lock.rb

#with_read_lock(blocking = true) ⇒ Object

Execute the given block after obtaining a read lock, and give up the lock when the block returns. If blocking is false, will raise an Errno::EAGAIN error without calling the block if the lock cannot be immediately established.



120
121
122
123
124
125
126
127
# File 'lib/arrow/session/lock.rb', line 120

def with_read_lock( blocking=true )
	begin
		self.read_lock( blocking ) or raise Errno::EAGAIN
		yield
	ensure
		self.release_read_lock
	end
end