win32utils-devel@rubyforge.org
2004-May-11 23:10 UTC
[Win32utils-devel] Possible bug in Win32::Semaphore.new
Hi all, I''ve committed most of the files for win32-semaphore. I did happen to notice one bug (thanks to TestUnit!) - it looks like Semaphore.new doesn''t raise an error if I try to pass a max count smaller than the initial count, e.g. s = Semaphore.new(3,2). The MSDN docs say that should be illegal and a small bit of pure C code raises error 87. However, this test fails: # in tc_semaphore.rb def test_invalid_constructor assert_raises(Win32::SemaphoreError){ Semaphore.new(1,0) } end Looking at semaphore.c, shouldn''t we check to see if the handle is NULL? Just curious if there was a reason for only checking against INVALID_HANDLE_VALUE. Regards, Dan