Method: Async::Semaphore#acquire

Defined in:
lib/async/semaphore.rb

#acquireObject

Acquire the semaphore, block if we are at the limit. If no block is provided, you must call release manually.



79
80
81
82
83
84
85
86
87
88
89
90
91
# File 'lib/async/semaphore.rb', line 79

def acquire
	wait
	
	@count += 1
	
	return unless block_given?
	
	begin
		return yield
	ensure
		self.release
	end
end