Sha256: 68df3b0537325e5b1ca3da602358ccd67fbe466150baff19842298894d91543b

Contents?: true

Size: 698 Bytes

Versions: 1

Compression:

Stored size: 698 Bytes

Contents

# Monkey patch for standard sync.rb (see bug #11680 on RubyForge).

if RUBY_VERSION < "1.8.7" or (RUBY_VERSION == "1.8.7" and RUBY_PATCHLEVEL < 173)

module Sync_m
  class Err < StandardError
    def Err.Fail(*opt)
      Thread.critical = false
      fail self, sprintf(self::Message, *opt)
    end
  end

  def sync_try_lock(mode = EX)
    return unlock if mode == UN

    Thread.critical = true
    ret = sync_try_lock_sub(mode)
    Thread.critical = false
    ret
  end
end

elsif RUBY_VERSION == "1.9.0"

module Sync_m
  def sync_try_lock(mode = EX)
    return unlock if mode == UN
    ret = nil
    @sync_mutex.synchronize do
      ret = sync_try_lock_sub(mode)
    end
    ret
  end
end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
syncache-1.0.0 lib/syncache_sync_patch.rb