Sha256: c058ba9708224938962bea63a4991e63a55706995e1738a316629566b107cdbb

Contents?: true

Size: 447 Bytes

Versions: 1

Compression:

Stored size: 447 Bytes

Contents

module RevealCK
  module Commands
    # Utility that wakes up a thread periodically
    class ThreadWaker
      def initialize(thread_to_wake, wait_period = 1)
        @thread_to_wake = thread_to_wake
        @wait_period = wait_period
      end

      def run
        Thread.new do
          loop do
            sleep @wait_period
            @thread_to_wake.wakeup if @thread_to_wake.alive?
          end
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
reveal-ck-4.0.0 lib/reveal-ck/commands/thread_waker.rb