in reply to Re^4: Threads, bash, and networking
in thread Threads, bash, and networking

When I run your code example, "main:Awooga!" is printed. When I comment out the top $SIG{ALRM} assignment, "Alarm clock" is printed. Here is the perl version for my linode:
[juster@artemis ~]$ perl -v This is perl 5, version 12, subversion 1 (v5.12.1) built for i686-linu +x-thread-multi Copyright 1987-2010, Larry Wall ...
Here is the version for my macbook. This perl behaves identically to the above perl in the way I mentioned at the top of this note.
bash-3.2$ perl -v This is perl, v5.10.0 built for darwin-thread-multi-2level (with 2 registered patches, see perl -V for more detail) Copyright 1987-2007, Larry Wall ...

Replies are listed 'Best First'.
Re^6: Threads, bash, and networking
by BrowserUk (Patriarch) on Oct 23, 2010 at 07:46 UTC
    When I run your code example, "main:Awooga!" is printed.

    Hm. Looks like another *nix/windows difference in implementation. I agree with you, that renders alarm in threads pretty much useless on *nix.

    Which is a shame because it is (currently) quite useful on windows. Presumably because all signals are just emulations there.

    I also think that in general mixing signals and threads is a bad idea, but I make this one exception for SIGALRM.


    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.