blob: fdaa4d418b89a14da1ce154ce3efbbbaacbc8aa8 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
# frozen_string_literal: true
class TestUbfAsyncSafe < Test::Unit::TestCase
def test_ubf_async_safe
skip 'need fork for single-threaded test' unless Process.respond_to?(:fork)
IO.pipe do |r, w|
pid = fork do
require '-test-/gvl/call_without_gvl'
r.close
trap(:INT) { exit!(0) }
Bug::Thread.ubf_async_safe(w.fileno)
exit!(1)
end
w.close
assert IO.select([r], nil, nil, 30), 'child did not become ready'
Process.kill(:INT, pid)
_, st = Process.waitpid2(pid)
assert_predicate st, :success?, ':INT signal triggered exit'
end
end
end
|