PHP PCNTL - what does pcntl_signal()'s restart_syscalls parameter do?

让人想犯罪 __ 提交于 2019-12-01 17:54:28

问题


I've been using PHP's PCNTL extension for a little while now, but can't figure out what the restart_syscalls parameter of pcntl_signal() does. I tried looking around the Internets, but couldn't find any information. All the documentation says is:

"Specifies whether system call restarting should be used when this signal arrives."

What is "system call restarting"?


回答1:


Suppose you programmed your signal handler to stop a process using signals like:

  • SIGTERM: to terminate a process; it can be blocked, handled, and ignored unlike SIGKILL.
  • SIGKILL: to immediately terminate a process
  • SIGSTOP: to pause the process in its current state

restart_syscalls specifies whether system call restarting should be used when signo arrives. Examples of signo are the three I listed above and there are much more.

This means, if restart_syscalls is set to the default value TRUE, this will restart certain system calls after a process that was stopped by a signal signo. It restarts the interrupted system call with a time argument that is suitably adjusted to account for the time that has already elapsed.

I forward you to this very simple and clear example: pcntl_wait not interrupted by SIGTERM



来源:https://stackoverflow.com/questions/32878380/php-pcntl-what-does-pcntl-signals-restart-syscalls-parameter-do

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!