[Win32utils-devel] win32-changenotify and events

Daniel Berger djberg96 at gmail.com
Mon Aug 6 08:43:01 EDT 2007

Hi all,

I've made some changes to the way that events are handled in 
win32-changenotify, and I wanted to verify that they were both 
appropriate and sensical.

First, win32-changenotify now requires win32-event. In the constructor, 
if an event isn't explicitly passed, a new Win32::Event object is 
created (instead of calling CreateEvent directly).

Then, in the ChangeNotify#wait method, I manually set the event's 
signaled state to true when it hits WAIT_OBJECT_0.

Does that seem appropriate?

Here's a quick sample program I used:

# test.rb
event = Win32::Event.new('test')
p event.signaled? # false

filter = ChangeNotify::FILE_NAME | ChangeNotify::DIR_NAME

cn = ChangeNotify.new("C:\\", true, filter, event)

cn.wait(10){ |x|
    p x

p event.signaled? # true if a change happened



More information about the win32utils-devel mailing list