What's the difference between various $SIG{CHLD} values?

后端 未结 4 1105
悲&欢浪女
悲&欢浪女 2020-12-16 22:22

What is the difference between these settings?

$SIG{CHLD} = \'IGNORE\'  
$SIG{CHLD} = \'DEFAULT\'  
$SIG{CHLD} = \'\'  
$SIG{CHLD} = undef

4条回答
  •  感动是毒
    2020-12-16 23:04

    $SIG{CHLD} = 'IGNORE'

    This is passed to the OS as SIG_IGN, which according to the OS docs, makes the child processes terminate without becoming zombies (or reporting their exit code to the parent).

    $SIG{CHLD} = 'DEFAULT'
    $SIG{CHLD} = ''
    $SIG{CHLD} = undef

    These are all the same at the OS level (they will call signal() with SIG_DFL). However some perl packages, notably AnyEvent::child, will not work when $SIG{CHLD} is set to 'DEFAULT'.

提交回复
热议问题