Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:39410 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 71625 invoked from network); 28 Jul 2008 15:28:25 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 28 Jul 2008 15:28:25 -0000 Authentication-Results: pb1.pair.com header.from=arnaud.lb@gmail.com; sender-id=pass; domainkeys=bad Authentication-Results: pb1.pair.com smtp.mail=arnaud.lb@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 66.249.82.236 as permitted sender) DomainKey-Status: bad X-DomainKeys: Ecelerity dk_validate implementing draft-delany-domainkeys-base-01 X-PHP-List-Original-Sender: arnaud.lb@gmail.com X-Host-Fingerprint: 66.249.82.236 wx-out-0506.google.com Received: from [66.249.82.236] ([66.249.82.236:21855] helo=wx-out-0506.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id A3/01-31471-695ED884 for ; Mon, 28 Jul 2008 11:28:23 -0400 Received: by wx-out-0506.google.com with SMTP id s12so1471570wxc.26 for ; Mon, 28 Jul 2008 08:28:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:from:to:subject:date :user-agent:cc:references:in-reply-to:mime-version:content-type :content-transfer-encoding:content-disposition:message-id; bh=SD6U7cmU7SSuiJeYNah8nVP7i+CcDzLbvJZ5KtMmiOs=; b=O2TsTs22Gsn0BJ8Hj6iaTY3r308CJdylupwSw/NhHvJCz+D90nT5omUP9pYE6ko0q9 p08OUkGhhhCB794Qf3Tg+bwj+ArrukXrfgjpmpCjFM7xZIKtC7aFP/a/NhVdrwg7eegl G3A6niPRzHdZZMGne6kyVywaUSAQUxfMnJtFM= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:subject:date:user-agent:cc:references:in-reply-to :mime-version:content-type:content-transfer-encoding :content-disposition:message-id; b=ZbWDDRI+pAnoSs8RMKwHSYA5XOhrTC+V1WVi9rrfsl4KNddDlwRbAkXUEZ8QZrS2Q4 m3zLJAEquyeuu8wE9eyaiDvTeCeGm9TCA4QTXMNf1sq9lBENAeumSPBlgrC6kh0ktN79 4+5W4wf/wpGUnUwKXiNnzH/tOI33tGpKju4GM= Received: by 10.100.8.4 with SMTP id 4mr8605832anh.38.1217258900034; Mon, 28 Jul 2008 08:28:20 -0700 (PDT) Received: from 207-177-41-213.getmyip.com ( [213.41.177.207]) by mx.google.com with ESMTPS id a68sm17491500rnc.12.2008.07.28.08.28.17 (version=SSLv3 cipher=RC4-MD5); Mon, 28 Jul 2008 08:28:18 -0700 (PDT) To: Derick Rethans Date: Mon, 28 Jul 2008 17:26:39 +0200 User-Agent: KMail/1.9.9 Cc: internals@lists.php.net References: <200807271551.30949.arnaud.lb@gmail.com> <200807271638.47548.arnaud.lb@gmail.com> In-Reply-To: <200807271638.47548.arnaud.lb@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-ID: <200807281726.40115.arnaud.lb@gmail.com> Subject: Re: [PHP-DEV] Replacement to ticks for signals From: arnaud.lb@gmail.com ("Arnaud Le Blanc") 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.