in reply to Re^8: Strawberry Perl and alarm() on Windows
in thread Strawberry Perl and alarm() on Windows

But PERL_SIGNALS does not affect the operating system in any way. Linux deliveres SIGALRM as it would for any other program. That means that the flock() system call (deep inside the perl flock() function) will be interrupted and will return EINTR immediately after the signal handler (deep inside the perl executable, not $SIG{'ALRM'}) has returned.

Sorry, but I think you're wrong. The signal is "delivered" to the process, but the process can block, or ignore it or (as perl since 5.8.1) defer it.

We are talking about a signal that has a custom signal handler set up. Blocking or ignoring is completely irrelevant for this discussion. But yes, the kernel runs through some code that decides if how the signal is handled. Options are:

This happens during delivery, before user mode code is called.

For some signals (SIGKILL and SIGSTOP), the only option is the default handler. The kernel will enforce that handler, even if you have managed to set up blocking, ignoring, or a signal handler for those signals.

What you call "defer" is not a special option for signal handling, but just a user mode signal handler that only sets a flag, combined with code to poll that flag later. This happens completely in user mode, inside the perl executable.

But, this is way outside my knowledge base

Yes, it seems so.

Alexander

--
Today I will gladly share my knowledge and experience, for there are no sweeter words than "I told you so". ;-)

Replies are listed 'Best First'.
Re^10: Strawberry Perl and alarm() on Windows
by BrowserUk (Patriarch) on May 24, 2015 at 20:57 UTC
    What you call "defer" is not a special option for signal handling,

    It's not my term, but rather that of the perl documentation: Deferred signals.

    This happens completely in user mode, inside the perl executable.

    Yes. But it still happens. Thus, Perl defers taking any action on the signal, until the current opcode has completed. That's how "safe signals" work.

    But, this is way outside my knowledge base. -- Yes, it seems so.

    It always amazes me how little the vast majority of linux users know about the way their OS works.


    With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
    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". I'm with torvalds on this
    In the absence of evidence, opinion is indistinguishable from prejudice. Agile (and TDD) debunked