lib/quack_concurrency/queue.rb
def pop(non_block = false)
      @pop_mutex.lock do
        @mutex.synchronize do
          if empty?
            return if closed?
            raise ThreadError if non_block
            @mutex.unlock
            @waiter.wait
            @mutex.lock
            return if closed?
          end
          @items.shift
        end
      end
    end
def pop(non_block = false)
      @pop_mutex.lock do
        @mutex.synchronize do
          if empty?
            return if closed?
            raise ThreadError if non_block
            @mutex.unlock
            @waiter.wait
            @mutex.lock
            return if closed?
          end
          @items.shift
        end
      end
    end
def pop ( non_block = false ) @pop_mutex . lock do @mutex . synchronize do if empty? return if closed? raise ThreadError if non_block @mutex . unlock @waiter . wait @mutex . lock return if closed? end @items . shift end end end
Retrieves an item from it.
 @note If it is empty, the method will block until an item is available.
 If +non_block+ is +true+, a +ThreadError+ will be raised.
 @raise [ThreadError] if it is empty and +non_block+ is +true+
 @param non_block [Boolean]
 @return [Object]
Retrieves an item from it .