Sha256: 0a2e6d95ce51b2f68e8a031e5effe93155202ca5de15d266091598ee1b746340

Contents?: true

Size: 308 Bytes

Versions: 5

Compression:

Stored size: 308 Bytes

Contents

require 'page_by_page/enum'

class PageByPage
  class MutexEnum < Enum

    def initialize from: 1, step: 1
      super
      @q = SizedQueue.new 10
      Thread.new do
        loop do
          @q << @enum.next
          sleep 0.1
        end
      end
    end

    def next
      @q.deq
    end

  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
page_by_page-0.1.10 lib/page_by_page/mutex_enum.rb
page_by_page-0.1.9 lib/page_by_page/mutex_enum.rb
page_by_page-0.1.8 lib/page_by_page/mutex_enum.rb
page_by_page-0.1.7 lib/page_by_page/mutex_enum.rb
page_by_page-0.1.6 lib/page_by_page/mutex_enum.rb