Sha256: d0146d837002947aef7753c62032c3d9608b2d16485f3f0d69d0cf2c8e48eab6

Contents?: true

Size: 758 Bytes

Versions: 28

Compression:

Stored size: 758 Bytes

Contents

require "thread"

module GorgonBunny
  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
          GorgonBunny::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

28 entries across 28 versions & 1 rubygems

Version Path
gorgon-0.11.1 lib/gorgon_bunny/lib/gorgon_bunny/concurrent/continuation_queue.rb
gorgon-0.11.0 lib/gorgon_bunny/lib/gorgon_bunny/concurrent/continuation_queue.rb
gorgon-0.10.5 lib/gorgon_bunny/lib/gorgon_bunny/concurrent/continuation_queue.rb
gorgon-0.10.4 lib/gorgon_bunny/lib/gorgon_bunny/concurrent/continuation_queue.rb
gorgon-0.10.3 lib/gorgon_bunny/lib/gorgon_bunny/concurrent/continuation_queue.rb
gorgon-0.10.2 lib/gorgon_bunny/lib/gorgon_bunny/concurrent/continuation_queue.rb
gorgon-0.10.1 lib/gorgon_bunny/lib/gorgon_bunny/concurrent/continuation_queue.rb
gorgon-0.10.0 lib/gorgon_bunny/lib/gorgon_bunny/concurrent/continuation_queue.rb
gorgon-0.9.0 lib/gorgon_bunny/lib/gorgon_bunny/concurrent/continuation_queue.rb
gorgon-0.8.4 lib/gorgon_bunny/lib/gorgon_bunny/concurrent/continuation_queue.rb
gorgon-0.8.3 lib/gorgon_bunny/lib/gorgon_bunny/concurrent/continuation_queue.rb
gorgon-0.8.2 lib/gorgon_bunny/lib/gorgon_bunny/concurrent/continuation_queue.rb
gorgon-0.8.1 lib/gorgon_bunny/lib/gorgon_bunny/concurrent/continuation_queue.rb
gorgon-0.8.0 lib/gorgon_bunny/lib/gorgon_bunny/concurrent/continuation_queue.rb
gorgon-0.7.1 lib/gorgon_bunny/lib/gorgon_bunny/concurrent/continuation_queue.rb
gorgon-0.7.0 lib/gorgon_bunny/lib/gorgon_bunny/concurrent/continuation_queue.rb
gorgon-0.7.0.rc4 lib/gorgon_bunny/lib/gorgon_bunny/concurrent/continuation_queue.rb
gorgon-0.7.0.rc3 lib/gorgon_bunny/lib/gorgon_bunny/concurrent/continuation_queue.rb
gorgon-0.7.0.rc2 lib/gorgon_bunny/lib/gorgon_bunny/concurrent/continuation_queue.rb
gorgon-0.7.0.rc1 lib/gorgon_bunny/lib/gorgon_bunny/concurrent/continuation_queue.rb