Sha256: 1a3196b9bad081a4e9ac43a98950cb8aae4b7a2899faea66717bbf460576bc4c

Contents?: true

Size: 746 Bytes

Versions: 18

Compression:

Stored size: 746 Bytes

Contents

require "thread"

module Bunny
  module Concurrent
    # Continuation queue implementation for MRI and Rubinius
    #
    # @private
    class ContinuationQueue
      def initialize(*args, &block)
        @q = ::Queue.new(*args)
      end

      def push(*args)
        @q.push(*args)
      end
      alias << push

      def pop
        @q.pop
      end

      def poll(timeout_in_ms = nil)
        if timeout_in_ms
          Bunny::Timeout.timeout(timeout_in_ms / 1000, ::Timeout::Error) do
            @q.pop
          end
        else
          @q.pop
        end
      end

      def clear
        @q.clear
      end

      def method_missing(selector, *args, &block)
        @q.__send__(selector, *args, &block)
      end
    end
  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
bunny-1.1.3 lib/bunny/concurrent/continuation_queue.rb
bunny-1.1.2 lib/bunny/concurrent/continuation_queue.rb
bunny-1.1.1 lib/bunny/concurrent/continuation_queue.rb
bunny-1.1.0 lib/bunny/concurrent/continuation_queue.rb
bunny-1.1.0.rc1 lib/bunny/concurrent/continuation_queue.rb
bunny-1.0.7 lib/bunny/concurrent/continuation_queue.rb
bunny-1.0.6 lib/bunny/concurrent/continuation_queue.rb
bunny-1.0.5 lib/bunny/concurrent/continuation_queue.rb
bunny-1.1.0.pre2 lib/bunny/concurrent/continuation_queue.rb
bunny-1.1.0.pre1 lib/bunny/concurrent/continuation_queue.rb
bunny-1.0.4 lib/bunny/concurrent/continuation_queue.rb
bunny-1.0.3 lib/bunny/concurrent/continuation_queue.rb
bunny-1.0.2 lib/bunny/concurrent/continuation_queue.rb
bunny-1.0.1 lib/bunny/concurrent/continuation_queue.rb
bunny-1.0.0 lib/bunny/concurrent/continuation_queue.rb
bunny-1.0.0.rc3 lib/bunny/concurrent/continuation_queue.rb
bunny-1.0.0.rc2 lib/bunny/concurrent/continuation_queue.rb
bunny-0.10.8 lib/bunny/concurrent/continuation_queue.rb