Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:65370 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 39339 invoked from network); 29 Jan 2013 13:00:52 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 29 Jan 2013 13:00:52 -0000 Authentication-Results: pb1.pair.com smtp.mail=tyra3l@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=tyra3l@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.210.178 as permitted sender) X-PHP-List-Original-Sender: tyra3l@gmail.com X-Host-Fingerprint: 209.85.210.178 mail-ia0-f178.google.com Received: from [209.85.210.178] ([209.85.210.178:61707] helo=mail-ia0-f178.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id E9/F5-10721-308C7015 for ; Tue, 29 Jan 2013 08:00:51 -0500 Received: by mail-ia0-f178.google.com with SMTP id y26so495057iab.37 for ; Tue, 29 Jan 2013 05:00:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:in-reply-to:references:date:message-id :subject:from:to:cc:content-type; bh=HdJ+GwKa61fEUVd1D1td5S/eV1lugd4bwD67oCxSelk=; b=hV5V4wnf15MuI50EudNhFW2/Z8irrnMGtWHx2Q2AdrOag9otKglRqcGpkkCnCepiBr 3/sbALXPKkUJfHZ+l7xx/6npWHrdq8aTc8hKFtpdqHCdYHAjWpyrMsJsxyGrSZ+JMxB1 cRljd7jvyWkymDNyQ8UMpVYWuTIeoUvweuZhkx2iD56wgLIxysU+DwLvjG3G51Dgj34t ABAnEwEKlRLlrkvL/RapU6dqVqmxjA1U1cBCM8YKXy0RyPpifL+G5vRsJ3yVb67pdKqS UQ4RsPzRtDvbNx3C6A2HVyFHVSsO1K/nKWAOom7spXYjJlHZwbMnAs0TIfhrEBSf610+ Z3Vw== MIME-Version: 1.0 X-Received: by 10.50.217.230 with SMTP id pb6mr838973igc.43.1359464448715; Tue, 29 Jan 2013 05:00:48 -0800 (PST) Received: by 10.50.106.138 with HTTP; Tue, 29 Jan 2013 05:00:48 -0800 (PST) In-Reply-To: <5107C093.1040808@lsces.co.uk> References: <5107C093.1040808@lsces.co.uk> Date: Tue, 29 Jan 2013 14:00:48 +0100 Message-ID: To: Lester Caine Cc: PHP internals Content-Type: multipart/alternative; boundary=14dae93411e78ceac704d46cfb85 Subject: Re: [PHP-DEV] Thread Safe ... From: tyra3l@gmail.com (Ferenc Kovacs) --14dae93411e78ceac704d46cfb85 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On Tue, Jan 29, 2013 at 1:29 PM, Lester Caine wrote: > Can someone please fill in a little information here. When we start > looking at multiple threads doing for example database lookups in paralle= l > with the main page generation. Does that involve 'thread safe' or is it > done in a different way? Scheduling a data lookup on one thread while > building the page the information is to be displayed on seems like a case > for threading in the web server? > > we don't have threads in userspace in php, sou you can't do concurrent execution of any function, but there are a couple of extensions providing some way for concurrent/async execution. for the scenario what you described one can use multiple db connections and async queries http://www.php.net/manual/en/mysqli.poll.php#refsect1-mysqli.poll-examplesf= or mysql or just a single connection and doing some other work (like rendering the layout) while waiting for the results. if you are interested in a generic solution for concurrent execution you could look into http://php.net/manual/en/book.pthreads.php --=20 Ferenc Kov=C3=A1cs @Tyr43l - http://tyrael.hu --14dae93411e78ceac704d46cfb85--