Sha256: a47a035d23ca19c6b185d9479f341d46b66ebfa85066ca283be267e6ea77c5eb

Contents?: true

Size: 404 Bytes

Versions: 3

Compression:

Stored size: 404 Bytes

Contents

class ResqueAdmin::ThreadSignal
  def initialize
    @mutex = Mutex.new
    @signaled = false
    @received = ConditionVariable.new
  end

  def signal
    @mutex.synchronize do
      @signaled = true
      @received.signal
    end
  end

  def wait_for_signal(timeout)
    @mutex.synchronize do
      unless @signaled
        @received.wait(@mutex, timeout)
      end

      @signaled
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
resque_admin-1.0.5 lib/resque_admin/thread_signal.rb
resque_admin-0.2.0 lib/resque_admin/thread_signal.rb
resque_admin-2.4.4 lib/resque_admin/thread_signal.rb