on Tue, 09 Jul 2002 20:26:12 GMT, Jenda Krynicky wrote:

> You mean that you get notified of a change, start processing it and 
> before you have the chance to start waiting again another change 
> occures but you do not notice it at all? Well I don't really know.

I did some additional research in Dave Roth's Win32 Perl Programming book.
Unfortunately, my first edition still discusses the now deprecated 
FindFirst and FindNext methods, but it seems changes are queued, as can be 
illustrated by the following small program:

    #! perl -w
    use strict;

    use Win32::ChangeNotify;

    my $notify = Win32::ChangeNotify->new('d:/',0,"FILE_NAME");
    
    open FILE, '>d:/foo'; close FILE;

    while ($notify->wait == 1) { 
        $notify->reset;
        print STDERR "Change occurred\n";
        # Do processing here ...
    }
    
    die "Should never arrive here!\n";

The monitoring process starts (restarts) after the call to new (reset), 
and (according to Roth) up to one change event is queued (which makes 
sense, because you will have the check the entire directory for changes 
anyway).

When I run this program, it immediately prints "Change occurred\n", and 
after the call to the reset method, it starts monitoring again, queueing 
when necessary. So no race conditions, which is nice :-)

-- 
felix

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to