2011-04-29 01:44:32 +00:00
|
|
|
# Mesure small and plenty pipe read/write.
|
|
|
|
# A performance may depend on GVL implementation.
|
|
|
|
|
2011-05-04 13:14:28 +00:00
|
|
|
lmax = 100_000
|
2011-04-29 01:44:32 +00:00
|
|
|
r, w = IO.pipe
|
|
|
|
[Thread.new{
|
|
|
|
lmax.times{
|
|
|
|
w.write('a')
|
|
|
|
}
|
|
|
|
p "w:exit"
|
|
|
|
}, Thread.new{
|
|
|
|
lmax.times{
|
|
|
|
r.read(1)
|
|
|
|
}
|
|
|
|
p "r:exit"
|
|
|
|
}].each{|t| t.join}
|
|
|
|
|