diff options
author | Eric Wong <normalperson@yhbt.net> | 2011-02-27 09:56:34 +0000 |
---|---|---|
committer | Eric Wong <normalperson@yhbt.net> | 2011-02-27 11:02:45 +0000 |
commit | 6d22887be14c6f543d86425545e79eff92d97714 (patch) | |
tree | 8be0ee7cb7e31eb9dbb136a3c6777e6811051a7b /test | |
parent | c02944edaed780bb20ad98ecdd11463d945b36ca (diff) | |
download | ruby_posix_mq-6d22887be14c6f543d86425545e79eff92d97714.tar.gz |
These flags can be changed in the parent or child process, so we will always have to run mq_getattr() to check it. This removes the GVL-keeping non-blocking optimizations but we'll gain some soon.
Diffstat (limited to 'test')
-rw-r--r-- | test/test_posix_mq.rb | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/test/test_posix_mq.rb b/test/test_posix_mq.rb index a7ea3b6..97b6337 100644 --- a/test/test_posix_mq.rb +++ b/test/test_posix_mq.rb @@ -280,6 +280,17 @@ class Test_POSIX_MQ < Test::Unit::TestCase assert_equal 0, @mq.attr.flags end + def test_setattr_fork + @mq = POSIX_MQ.new @path, IO::CREAT|IO::WRONLY, 0666 + mq_attr = POSIX_MQ::Attr.new(IO::NONBLOCK) + @mq.attr = mq_attr + assert @mq.nonblock? + + pid = fork { @mq.nonblock = false } + assert Process.waitpid2(pid)[1].success? + assert ! @mq.nonblock? + end + def test_new_nonblocking @mq = POSIX_MQ.new @path, IO::CREAT|IO::WRONLY|IO::NONBLOCK, 0666 assert @mq.nonblock? |