Re: Replacement to ticks for signals
| From: | Derick Rethans | Date: | Sun, 27 Jul 2008 14:04:58 +0000 |
| Subject: | Re: Replacement to ticks for signals | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-39375@lists.php.net to get a copy of this message | ||
On Sun, 27 Jul 2008, Arnaud Le Blanc wrote:
> Hi,
>
> I made a pcntl_signal_dispatch() function [1] to allow scripts that use
> signals to work without ticks.
>
> This function just calls the pcntl's tick handler on-demand so that all signal
> handler functions are called if there are pending signals.
>
> It does not allow the signal handlers to be called at any time like with
> ticks, but allows things like this:
>
> while (do_something()) {
> /* main loop */
> pcntl_signal_dispatch();
> }
>
> or
>
> while (pcntl_signal_dispatch() && do_something()) {
> /* main loop */
> }
Does the function block if there are no pending signals? If not, I think
we should make that an option.
regards,
Derick
--
HEAD before 5_3!: http://tinyurl.com/6d2esb
http://derickrethans.nl | http://ezcomponents.org | http://xdebug.org