Sha256: 9a0b61699aa292b287ab821a0805aabc5e7b6a6a7575b6239be33982d54edf26
Contents?: true
Size: 553 Bytes
Versions: 7
Compression:
Stored size: 553 Bytes
Contents
require 'thread' # monkey patch Mutex so it does not leak memory. class Mutex def lock while (Thread.critical = true; @locked) @waiting.unshift Thread.current Thread.stop end @locked = true Thread.critical = false self end def unlock return unless @locked Thread.critical = true @locked = false begin t = @waiting.pop t.wakeup if t rescue ThreadError retry end Thread.critical = false begin t.run if t rescue ThreadError end self end end
Version data entries
7 entries across 7 versions & 2 rubygems