[Win32utils-devel] Possible bug in Win32::Semaphore.new

win32utils-devel at rubyforge.org win32utils-devel at rubyforge.org
Tue May 11 22:39:37 EDT 2004

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, 

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) }

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 



More information about the win32utils-devel mailing list