Sha256: 3ba1e629999844026906554a6c6b7f62c06c036a1a974c95d6570af473e50631

Contents?: true

Size: 801 Bytes

Versions: 4

Compression:

Stored size: 801 Bytes

Contents

require 'monitor'


# Taken from http://redmine.ruby-lang.org/repositories/entry/ruby-19/lib/monitor.rb

module MonitorMixin
  class ConditionVariable
    def wait(timeout = nil)
      @monitor.__send__(:mon_check_owner)
      count = @monitor.__send__(:mon_exit_for_cond)
      begin
        @cond.wait(@monitor.instance_variable_get("@mon_mutex"), timeout)
        return true
      ensure
        @monitor.__send__(:mon_enter_for_cond, count)
      end
    end
  end
end


# Taken from http://redmine.ruby-lang.org/repositories/entry/ruby-19/lib/thread.rb

class ConditionVariable
  def wait(mutex, timeout=nil)
    begin
      # TODO: mutex should not be used
      @waiters_mutex.synchronize do
        @waiters.push(Thread.current)
      end
      mutex.sleep timeout
    end
    self
  end
end

Version data entries

4 entries across 4 versions & 2 rubygems

Version Path
firenxis-god-0.11.0 lib/god/compat19.rb
god-0.11.0 lib/god/compat19.rb
god-0.10.1 lib/god/compat19.rb
god-0.9.0 lib/god/compat19.rb