Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:15232 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 71009 invoked by uid 1010); 28 Feb 2005 20:24:25 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 70994 invoked from network); 28 Feb 2005 20:24:25 -0000 Received: from unknown (HELO pb1.pair.com) (127.0.0.1) by localhost with SMTP; 28 Feb 2005 20:24:25 -0000 X-Host-Fingerprint: 64.233.184.199 wproxy.gmail.com Linux 2.4/2.6 Received: from ([64.233.184.199:52903] helo=wproxy.gmail.com) by pb1.pair.com (ecelerity HEAD r(5124)) with SMTP id 5C/E8-43672-9FD73224 for ; Mon, 28 Feb 2005 15:24:25 -0500 Received: by wproxy.gmail.com with SMTP id 63so6544wri for ; Mon, 28 Feb 2005 12:24:18 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:in-reply-to:references:mime-version:content-type:message-id:cc:from:subject:date:to:x-mailer; b=Fow6QEPjUtXrYfzReW3l5Lv/UnoSyCShkzuHWMaiJAu3U4USwv1uLUfSdl02I022uImX6dVXabMUDgxdNjnXWn3JXQXZ+b/7nQKXQKnUnYLK9sVJG2Jkd0fhTFJy5HFhhymmWWr5vg6j+JpvmKLoK0Vhun+GEQVatTVmO1G3nbo= Received: by 10.54.17.14 with SMTP id 14mr40491wrq; Mon, 28 Feb 2005 12:24:17 -0800 (PST) Received: from ?192.168.100.101? ([68.22.220.206]) by mx.gmail.com with ESMTP id 67sm95772wra.2005.02.28.12.24.17; Mon, 28 Feb 2005 12:24:17 -0800 (PST) In-Reply-To: References: <2005022807371112877%drbob@TheManFromSPUDcom> <42233717.9050107@akbkhome.com> Mime-Version: 1.0 (Apple Message framework v619.2) Content-Type: multipart/alternative; boundary=Apple-Mail-9-318542782 Message-ID: <729eaf208f6ab01379951b88d8f90b76@gmail.com> Cc: internals@lists.php.net Date: Mon, 28 Feb 2005 14:24:05 -0600 To: Vadka X-Mailer: Apple Mail (2.619.2) Subject: Re: [PHP-DEV] How to embed PHP5 into multi-threaded C app? From: drbobbeaty@gmail.com (Bob Beaty) --Apple-Mail-9-318542782 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII; format=flowed Which is my concern. I've looked at the code differences, and it appears that this modification works for running different source files through the engine, but I'm concerned about the safety of zend_eval_string() if I initialize the engine in one thread and then try to have several threads calling zend_eval_string() on different strings. I'm not convinced that simply making the php_embed_module thread-local is going to work either. I'm concerned that the engine was written with the idea that only one thread can be initializing the php_embed_module and making calls to zend_eval_string(). If this is the case, then I'd have to re-write a lot more than php_embed.c to get thread-safety out of the engine. Or am I on the wrong track? Bob On Feb 28, 2005, at 1:08 PM, Vadka wrote: > > On Mon, 28 Feb 2005, Alan Knowles wrote: > >> these still need tidying up alot, but the do work. >> http://docs.akbkhome.com/php_embed.c.txt >> http://docs.akbkhome.com/php_embed.h.txt >> replace the code in php_embed with them, make sure you compile with >> the zts enabled, and the macros's are similar to the original embed >> (use threaded start call at application start up, and thread start >> /start end within the pthread_start(...callback..) method > Thread safeness is not a problem for a single thread. > The problem is to call user functions from different threads > (tsrm_ls pointed to somewhere in different threads, global vars etc > are not protected). Thanks, Bob (drbob@TheManFromSPUD.com) The Man from S.P.U.D. We will write no code before it's designed. --Apple-Mail-9-318542782--