Re: [RFC] Zend Signal Handling

From: Date: Tue, 05 Aug 2008 10:45:00 +0000
Subject: Re: [RFC] Zend Signal Handling
References: 1  Groups: php.internals 
Request: Send a blank email to internals+get-39661@lists.php.net to get a copy of this message
On Tuesday 05 August 2008 12:28:19 Lucas Nealan wrote: > On 8/4/08 11:51 PM, "Arnaud Le Blanc" <arnaud.lb@gmail.com> wrote: > > global_sigmask is initialized using sigfillset(), so it contains _all_ > > signals (except SIGSEGV, etc because non-blockable or not safe to block) > > and there is no need to add signals to global_sigmask it in zend_signal() > > / > > zend_signal_register() :) > > Right you are. Apparently I saw it was doing that but it didn't really > register. > > > For extensions IMO we should just let them use zend_signal() as it > > currently is. Using pcntl_signal() will override handlers previously set > > by zend_signal() but the signal will remain deferred. > > I don't see how it would continue to be deferred. Any signal handler registered using zend_signal()/zend_sigaction() is deferred as these functions actually register zend_signal_handler_differ(), which calls the actual handler depending if critical section or not ;) In the case of pcntl_signal(), if it registers a handler for a signal, the signal will be delivered to zend_signal_handler_defer(), which will call zend_signal_handler() if not in critical section, which will call the actual handler registered by pcntl_signal(), pcntl_signal_handler(). Then the user signal handler will be called at the next tick or the next time zend_signal_dispatch() is called. > We'd be relying on the > fact that pcntl depends on a tick or call to the dispatch function to > actually invoke any userspace code. Once registering a signal via pcntl I'm > able to jump out of a critical section into pctl_signal_handler when a > signal is received. This code might be safe since it doesn't do very much > but I don't get real protection. > > > I updated the patches on the wiki: > > - Added zend_sigaction() > > - Ported PCNTL to use zend_sigaction() > > - Fixed handling of SIG_IGN > > Great. I'll pull these down. > > -lucas

« previous php.internals (#39661) next »