Hi all,
The Win32 Utils Team is happy to announce the first release of
win32-changenotify.
What is it?
···
===========
A class for monitoring events on files and directories. Modelled on
the Win32::ChangeNotify Perl module.
Where is it?
It can be found on the project home page at
http://www.rubyforge.org/projects/win32utils and (hopefully soon) on
the RAA.
Note: requires win32-ipc.
Enjoy!
The Win32 Utils Team
Hi,
nice job, but does not work with threads …
The t2 thread in the following code almost never runs (since the “cn.wait”
in the first thread blocks the main ruby thread and any other thread).
Is there any plan to correct this ?
require “win32/changenotify”
include Win32
t1 = Thread.new {
cn = ChangeNotify.new(“c:\”,false,ChangeNotify::FILE_NAME |
ChangeNotify::DIR_NAME)
# Check for file and/or dir changes for 5 minute
puts "This script will wait on notifications for 5 minutes"
1.upto(3){
if cn.wait(100000) == 1
puts "change notified"
cn.reset
end
sleep 1
}
}
t2 = Thread.new {
300.times {|i|
sleep(0.5)
puts i
}
}
t2.join
t1.join
···
Hi all,
The Win32 Utils Team is happy to announce the first release of
win32-changenotify.