开发者

posix_kill vs pcntl_signal

This is a bit esoteric and it's possible this question will go unanswered until I troll the the source myself and answer it, but here goes:

I'm the author of a simple PHP Daemon library: https://github.com/shaneharter/PHP-Daemon. While PHP isn't ideal for this sort of thing, sometimes people need to daemonize or write crons in PHP and wrote the library to make that task a lot easier on the "uninitiated."

I'm implementing the JavaScript Workers API for the library and I'm considering adding a dependency on POSIX (right开发者_StackOverflow社区 now it's doing everything with PCNTL).

Does anybody know what the difference is between PCNTL_SIGNAL and POSIX_KILL? I can use either to send any signal to any process. So.... is one better than the other? Or are they both really doing the same thing under the hood?


posix_kill() is used to send a signal to a process.

pcntl_signal() is used to listen for signals received by the calling process (your script).

See the examples here.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜