Last active
December 24, 2023 11:46
-
-
Save jpcamara/e54d6dd5e2c779e20c94b9c3e5cb14c6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# hangs, same as MN threads | |
# RUBY_MN_THREADS=1 make test-all TESTS="--name=TestIO#test_open_fifo_does_not_block_other_threads" | |
require "tempfile" | |
require "async" | |
def mkcdtmpdir | |
Dir.mktmpdir {|d| | |
Dir.chdir(d) { | |
yield | |
} | |
} | |
end | |
mkcdtmpdir { | |
File.mkfifo("fifo") | |
Async do |task| | |
t1 = task.async { | |
open("fifo", "r") {|r| | |
r.read | |
} | |
} | |
t2 = task.async { | |
open("fifo", "w") {|w| | |
w.write "foo" | |
} | |
} | |
# Hangs indefinitely | |
puts t1.wait | |
end | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment