Re: [rt.cpan.org #73747] signal handlers don't work while waiting

[email protected] ("Cary Lewis via RT")
Newsgroups perl.libwin32
Message-ID <[email protected]>
Fri Jan 06 23:51:32 2012: Request 73747 was acted upon.
Transaction: Correspondence added by [email protected]
       Queue: Win32-IPC
     Subject: Re: [rt.cpan.org #73747] signal handlers don't work while waiting
   Broken in: (no value)
    Severity: (no value)
       Owner: Nobody
  Requestors: [email protected]
      Status: stalled
 Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=73747 >


I've tried everything I could think of, but was not successful in getting
the signal handler to work while perl was sitting inside the
WaitForSingleObject, inside of ipc code.

However, I was able to work around the issue by utilizing threads - if I
spin up a perl thread and do the change notify in it, and detach this
thread from the main thread, both the change notify blocking functionality
works, and the signal handler works.

I can use condition variables to signal the change in the directory to the
main thread.

So, this isn't really a fix, just a workaround, but I wonder where I can
post this little titbit of knowledge.

On Wed, Jan 4, 2012 at 4:54 PM, Christopher J. Madsen via RT <
[email protected]> wrote:

> <URL: https://rt.cpan.org/Ticket/Display.html?id=73747 >
>
> The behavior I see with Windows XP and Perl 5.14.2 is this: if a signal
> handler is active, it's not called until the wait completes (because a
> notification happens or it times out).  I'm not clear whether you're
> seeing the same thing.
>
> I believe this is because of Perl's deferred signal handling:
> http://perldoc.perl.org/perlipc.html#Deferred-Signals-%28Safe-Signals%29
>
> I agree that's probably not the most desirable behavior, but I don't
> know how to change it.  I'd welcome a pull request
> (https://github.com/madsen/win32-ipc) if you have a solution.
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.