Wed Jan 04 14:14:44 2012: Request 73747 was acted upon.
Transaction: Ticket created by cary.le...@gmail.com
       Queue: Win32-IPC
     Subject: question / possible bug with Win32::IPC
   Broken in: (no value)
    Severity: (no value)
       Owner: Nobody
  Requestors: cary.le...@gmail.com
      Status: new
 Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=73747 >


I am using Win::IPC via Win::ChangeNotify, and I have noticed that if I
have a signal handler active at the time of doing a wait, then the signal
that is being "handled" is ignored.

The following code demonstrates the issue:

use Win32::ChangeNotify;

$WatchSubTree = 0;

$Events="FILE_NAME";

$notify = Win32::ChangeNotify->new(".", $WatchSubTree, $Events);

$SIG{INT} = sub {print "ok\n";exit;};

print "during this sleep, intr will be caught!\n";
sleep(2);

while(1)
{
        print "waiting\n";

        $notify->wait();

        print "change!\n";

        $notify->reset;
}

Once the $notify->wait() call is executed, the $SIG{INT} no longer works,
and furthermore, hitting ctrl-c no longer interrupts the wait.

Without the $SIG{INT} code, ctrl-c does interrupt the wait.

I tried to search for Win32::IPC wait and signal handler - but didn't see
anything relevant, so I hope you don't mind me sending you an email.

BTW, I running this on Windows 7 32bit under Cygwin and I also reproduced
this with the strawberry perl.

Any insight would be most appreciated.

Reply via email to