Posted By: Rat (Jsem Krysa...) on 'CZscripts'
Title:     jeste k signalum v perlu
Date:      Thu Mar 11 20:44:28 1999

i Zdar,
jestli jsem spravne pochopil z perlipc, tak kdyz chcu prerusitelne zavolat 
syscall, tak to mam udelat asi takhle (ty printfy budou vysvetleny pozdeji):

printf("x0n");
$SIG{'HUP'} = sub { $x = 1; };
printf("x1n");
eval {
  printf("x2n");
  local $SIG{'HUP'} = ¨
  printf("x3n");
  die if ($x);
  select(undef, undef, undef, undef); # jenom priklad
};

strace vypada asi takhle:
write(1, "x0n", 3)                     = 3
sigaction(SIGHUP, {0x807c964, [], 
SA_STACK|SA_RESTART|SA_INTERRUPT|SA_ONESHOT|0x7fffa78}, {SIG_DFL}) = 0
write(1, "x1n", 3)                     = 3
write(1, "x2n", 3)                     = 3
sigaction(SIGHUP, {SIG_DFL}, {0x807c964, [], 
SA_STACK|SA_RESTART|SA_INTERRUPT|SA_ONESHOT|0x7fffa18}) = 0
sigaction(SIGHUP, {0x807c964, [], 0}, {SIG_DFL}) = 0
write(1, "x3n", 3)                     = 3
select(0, NULL, NULL, NULL, NULL)       = ? ERESTARTNOHAND (To be restarted)

 Ten SIG_DFL je featura nebo bug? V pripade, ze featura, da se v perlu udelat 
to, co mam na mysli, nejak bezpecne?

        Krysa
                rat@atrey.karlin.mff.cuni.cz              Jsem Krysa
                http://atrey.karlin.mff.cuni.cz/~rat

Search the boards