Sha256: a3857ea0d954619c0f4313b667807abaa74d7b04bfc18c72bc54bd36c75f0e33
Contents?: true
Size: 895 Bytes
Versions: 4
Compression:
Stored size: 895 Bytes
Contents
require 'test/unit' $-w = true require 'sleepy_penguin' class TestEpollGC < Test::Unit::TestCase include SleepyPenguin def setup GC.stress = true if GC.respond_to?(:stress=) @ep = Epoll.new end def teardown GC.stress = false if GC.respond_to?(:stress=) end def add_pipe_no_tailcall(m, depth) add_pipe(m, depth += 1) end def add_pipe(m, depth = 0) if depth > 6000 rd, wr = IO.pipe warn "wr: #{wr.fileno}" @ep.__send__(m, wr, Epoll::OUT) else add_pipe_no_tailcall(m, depth + 1) end end def test_gc_safety done = false begin if done x = nil @ep.wait(nil, 10) { |flags, obj| p [ flags, x = obj ] } assert x, "#{x.inspect}" break else add_pipe(:add) 2048.times { IO.pipe; File.open(__FILE__)} done = true end end while true end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
sleepy_penguin-1.4.0 | test/test_epoll_gc.rb |
sleepy_penguin-1.3.1 | test/test_epoll_gc.rb |
sleepy_penguin-1.3.0 | test/test_epoll_gc.rb |
sleepy_penguin-1.2.0 | test/test_epoll_gc.rb |