Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:79035 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 57489 invoked from network); 20 Nov 2014 11:19:33 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 20 Nov 2014 11:19:33 -0000 Authentication-Results: pb1.pair.com smtp.mail=lanxiaolu@meituan.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=lanxiaolu@meituan.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain meituan.com designates 211.151.229.38 as permitted sender) X-PHP-List-Original-Sender: lanxiaolu@meituan.com X-Host-Fingerprint: 211.151.229.38 mx-fe5-38.meituan.com Received: from [211.151.229.38] ([211.151.229.38:46230] helo=it-mail01.lf.sankuai.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 6C/87-14967-D3ECD645 for ; Thu, 20 Nov 2014 06:19:26 -0500 Received: from localhost (localhost [127.0.0.1]) by it-mail01.lf.sankuai.com (Postfix) with ESMTP id EDD882CB9331; Thu, 20 Nov 2014 19:19:20 +0800 (CST) Received: from it-mail01.lf.sankuai.com ([127.0.0.1]) by localhost (it-mail01.lf.sankuai.com [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id 20N0TPUQRdYI; Thu, 20 Nov 2014 19:19:20 +0800 (CST) Received: from localhost (localhost [127.0.0.1]) by it-mail01.lf.sankuai.com (Postfix) with ESMTP id B628E2CB935C; Thu, 20 Nov 2014 19:19:20 +0800 (CST) DKIM-Filter: OpenDKIM Filter v2.7.1 it-mail01.lf.sankuai.com B628E2CB935C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=meituan.com; s=20130113; t=1416482360; bh=EMCU3A/ALy0fWcAqdUyuMIYzuggCwfoxRv8bkmYhQ70=; h=Content-Type:Mime-Version:Subject:From:Date:Message-Id:To; b=tZobaZOjt2P7zrhcR8Dvb2XyL0RLCDvM73EG1NRVqCYXNEkNtOaQchFERozXDQrhw DtREDRWOTFyNprGgvD9i4G7fNeBvNoe/NaW+WsI52yg6W4cQkwV7Tl7rxpgq3h4oCK mBGXfe56TBzyu+fr20ZzEyXJ5/VL396f6wVID2nY= X-Virus-Scanned: amavisd-new at meituan.com Received: from it-mail01.lf.sankuai.com ([127.0.0.1]) by localhost (it-mail01.lf.sankuai.com [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id CtffFNo5u3q7; Thu, 20 Nov 2014 19:19:20 +0800 (CST) Received: from [192.168.165.165] (unknown [106.120.108.34]) (Authenticated sender: lanxiaolu@meituan.com) by it-mail01.lf.sankuai.com (Postfix) with ESMTPSA id 602182CB9331; Thu, 20 Nov 2014 19:19:20 +0800 (CST) Content-Type: multipart/alternative; boundary="Apple-Mail=_5F4CD3DC-ED76-419B-BA0E-0CAF5631C356" Mime-Version: 1.0 (Mac OS X Mail 7.3 \(1878.6\)) In-Reply-To: <1416479430.15061.15.camel@kuechenschabe> Date: Thu, 20 Nov 2014 19:19:17 +0800 Cc: Tigran Bayburtsyan , internals@lists.php.net Message-ID: References: <1416479430.15061.15.camel@kuechenschabe> To: =?GB2312?Q?Johannes_Schl=A8=B9ter?= X-Mailer: Apple Mail (2.1878.6) Subject: Re: [PHP-DEV] PHP SAPI module help From: lanxiaolu@meituan.com (=?GB2312?B?wLwg0KTCsw==?=) --Apple-Mail=_5F4CD3DC-ED76-419B-BA0E-0CAF5631C356 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=GB2312 How about writing this logic in an extension? Because u can write your = own RSHUTDOWN function to protect your data. sorry for my poor english. -- lanxiaolu =D4=DA 2014=C4=EA11=D4=C220=C8=D5=A3=AC=CF=C2=CE=E76:30=A3=ACJohannes = Schl=A8=B9ter =D0=B4=B5=C0=A3=BA > Hi, >=20 > On Tue, 2014-11-18 at 18:08 +0400, Tigran Bayburtsyan wrote: >> I need to execute PHP code in some thread of my application and = continue >> excecution in another. Is is possible to somehow get all global PHP = core >> hashtables from first thread and restore PHP from that point in = another >> thread using that hashtables with all generated variables and = functions ? >=20 > PHP works request base. Meaning the idea is to have isolated > shared-nothing requests. >=20 > PHP can run in two modes: >=20 > 1. In a global environment, or > 2. in a threaded environment >=20 > this is controlled by enabling or disabling ZTS - zend thread safety / > TSRM thread-safe resource manager. In the first case you have a global > state running one "request" at a time, theoretically this single = request > context can be accessd by multiple threads while access has to be > guarded by some mutex. > In the second case you can have multiple requests which separate = state. > Each of those is bound to a (posix|windows) thread sharing a context = in > this mode between different threads can't be easily done and requires > patching (in non-public code I once created worker threads owning the > PHP request and different threads can signal there to bypass, but = that's > a mess). >=20 > The probably most simple SAPI using different threads is my pconn = SAPI: > https://github.com/johannes/pconn-sapi >=20 > Except for source we don't really have good documentation on all the > details. So please try to go through different SAPIs and try to > understand them. Specific questions are welcome on this list. >=20 > johannes >=20 >=20 >=20 > --=20 > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php >=20 --Apple-Mail=_5F4CD3DC-ED76-419B-BA0E-0CAF5631C356--