Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:60632 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 44998 invoked from network); 21 May 2012 19:15:56 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 21 May 2012 19:15:56 -0000 Authentication-Results: pb1.pair.com header.from=ceo@l-i-e.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=ceo@l-i-e.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain l-i-e.com designates 67.139.134.202 as permitted sender) X-PHP-List-Original-Sender: ceo@l-i-e.com X-Host-Fingerprint: 67.139.134.202 o2.hostbaby.com FreeBSD 4.7-5.2 (or MacOS X 10.2-10.3) (2) Received: from [67.139.134.202] ([67.139.134.202:4359] helo=o2.hostbaby.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id E7/05-16352-A649ABF4 for ; Mon, 21 May 2012 15:15:55 -0400 Received: (qmail 83907 invoked by uid 98); 21 May 2012 19:15:55 -0000 Received: from localhost by o2.hostbaby.com (envelope-from , uid 1013) with qmail-scanner-2.05 ( Clear:RC:1(127.0.0.1):. Processed in 0.040405 secs); 21 May 2012 19:15:55 -0000 Received: from localhost (HELO www.l-i-e.com) (127.0.0.1) by localhost with SMTP; 21 May 2012 19:15:55 -0000 Received: from webmail (SquirrelMail authenticated user ceo@l-i-e.com) by www.l-i-e.com with HTTP; Mon, 21 May 2012 14:15:55 -0500 Message-ID: In-Reply-To: <2e18b5931575b8ceffde79055640@news.php.net> References: <2e18b5931575b8ceffde79055640@news.php.net> Date: Mon, 21 May 2012 14:15:55 -0500 To: "PHP internals" User-Agent: SquirrelMail/1.4.21 [SVN] MIME-Version: 1.0 Content-Type: text/plain;charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Priority: 3 (Normal) Importance: Normal Subject: Re: [PHP-DEV] Persist context across threads? From: ceo@l-i-e.com ("Richard Lynch") On Mon, May 14, 2012 1:47 pm, David Rueter wrote: > I am interested in preserving the complete PHP context for a thread > (globals, > variables, interpreter, etc.--everything) for later access from a > different > thread. > > What would be involved in this? It seems like: > > 1) Avoid calling ts_free_thread > 2) Call tsrm_set_interpreter_context from new thread > > Is it safe to assume that the context of a terminated thread will not > be > destroyed or overwritten as long as ts_free_thread is not called? I don't really know what I'm talking about, but nobody has answered yet... For starters, not all extensions are thread-safe. I would expect that to mean that anything actively using those extensions saved state in another thread is a segfault waiting to happen. For security reasons and sheer plain cussedness, I don't think you're going want and/or get any resource (mysql connection/result/etc, gd images, file handles, etc) survive to the next thread. A mysql connection, for example, is opened with a specific user/pass. Another thread picking this up could probably abuse that, as I understand it. Finally, your question begs another question: Why do you want to do this? -- brain cancer update: http://richardlynch.blogspot.com/search/label/brain%20tumor Donate: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=FS9NLTNEEKWBE