in reply to Re: Alarms with ActivePerl do not work properly (small modification)
in thread Alarms with ActivePerl do not work properly

The problem is that the signal emulation won't interrupt a blocking read.

Did I test it wrong, cause it wasn't triggering for me after the read returned either.

  • Comment on Re^2: Alarms with ActivePerl do not work properly (small modification)

Replies are listed 'Best First'.
Re^3: Alarms with ActivePerl do not work properly (small modification)
by BrowserUk (Patriarch) on Jan 13, 2011 at 19:15 UTC
    Did I test it wrong,

    No, your test is correct, though the interpretation may be a little off.

    In this case, it isn't that the IO is causing the signal to be deferred. The alarm 'signal' is being simulated by a one-shot timer, which as the name applies happens once. If the code is not in an interuptable state when it does, the timer is effectively discarded.

    That could be fixed by using an Overlapped-IO Read and entering an interuptable wait and cancelling the pending IO if the timer goes off.

    Indeed, ubiquitous use of Overlapped IO would allow the whole select/signals emulation to be done in a far more POSIX-compliant fashion, but that would be a major re-write of the perl/win32 subsystems and I can't see anyone taking that task on.


    Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
    "Science is about questioning the status quo. Questioning authority".
    In the absence of evidence, opinion is indistinguishable from prejudice.