Method: XThread::RBSizedQueue#push

Defined in:
lib/xthread.rb

#push(obj) ⇒ Object Also known as: <<, enq

Pushes obj to the queue. If there is no space left in the queue, waits until space becomes available.



197
198
199
200
201
202
203
204
205
206
207
# File 'lib/xthread.rb', line 197

def push(obj)
  @mutex.synchronize{
	while true
	  break if @que.length < @max
	  @cond_wait.wait(@mutex)
	end

	@que.push obj
	@cond.signal
  }
end