Sha256: 5c7c763f462a7a60bf23042f16c8cef662972fd7d6fd01be3169368d7fcd101d
Contents?: true
Size: 601 Bytes
Versions: 1
Compression:
Stored size: 601 Bytes
Contents
# encoding: UTF-8 require 'em-synchrony' # Monkey-patch module Kernel alias_method :orig_sleep, :sleep class << self attr_accessor :em_synchrony_sleep_hook end # Monkey-patch def sleep(*args) if Kernel.em_synchrony_sleep_hook && EM.reactor_thread? && !Thread.current[:em_synchrony_sleep_hook_called] begin Thread.current[:em_synchrony_sleep_hook_called] = true Kernel.em_synchrony_sleep_hook.call(args[0]) ensure Thread.current[:em_synchrony_sleep_hook_called] = false end else orig_sleep(*args) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
em-synchrony-1.0.6 | lib/em-synchrony/kernel.rb |