def test_push_close
spin_lock1 = true
spin_lock2 = true
Thread.new{
@queue.push(PseudoIO.new)
@queue.push(PseudoIO.new)
spin_lock1 = false
@queue.push(PseudoIO.new)
@queue.push(PseudoIO.new)
}
Thread.new{
while (spin_lock1)
end
@queue.push_close
@queue.push_close
spin_lock2 = false
}
while (spin_lock2)
end
assert_equal(Rucy::SocketQueue::CMD_CLOSE, @queue.pop)
assert_equal(Rucy::SocketQueue::CMD_CLOSE, @queue.pop)
assert_instance_of(PseudoIO, @queue.pop)
assert_instance_of(PseudoIO, @queue.pop)
assert_instance_of(PseudoIO, @queue.pop)
assert_instance_of(PseudoIO, @queue.pop)
end