On Sunday 27 July 2008 16:38:47 Arnaud Le Blanc wrote:
> On Sunday 27 July 2008 16:04:58 Derick Rethans wrote:
> > 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.
> >
>
> No, but I was thinking to implement sigwaitinfo()/sigtimedwait(), which
blocks
> indefinitly or for a given time until a signal is delivered. This also
> requires to implement sigprocmask().
>
> It would also be great to have signalfd() (which is select()able), but it's
> Linux specific and requires quite recent Kernel and libc (that said, I'm
> going to implement it if there are positive feedbacks about that).
>
I added pcntl_sigwaitinfo(), pcntl_sigtimedwait() and pcntl_sigprocmask() to
my patch:
http://arnaud.lb.s3.amazonaws.com/pcntl.patch
pcntl_sigwaitinfo() allows to block until the specified signals have been
delivered.
pcntl_sigtimedwait() does the same thing, but with a timeout.
pcntl_sigprocmask() allows to block a set of signals so that they will not be
delivered between two calls of the above functions.
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php