Sha256: 80881c0edc810295a5cd23693250e8e975af25546cbdebfbe51da7b66905c639

Contents?: true

Size: 799 Bytes

Versions: 12

Compression:

Stored size: 799 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

12 entries across 12 versions & 3 rubygems

Version Path
resurrected_god-0.14.0 lib/god/compat19.rb
mcproc-2016.2.20 lib/god/compat19.rb
god-0.13.7 lib/god/compat19.rb
god-0.13.6 lib/god/compat19.rb
god-0.13.5 lib/god/compat19.rb
god-0.13.4 lib/god/compat19.rb
god-0.13.3 lib/god/compat19.rb
god-0.13.2 lib/god/compat19.rb
god-0.13.1 lib/god/compat19.rb
god-0.13.0 lib/god/compat19.rb
god-0.12.1 lib/god/compat19.rb
god-0.12.0 lib/god/compat19.rb