Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:43507 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 94459 invoked from network); 27 Mar 2009 02:38:51 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 27 Mar 2009 02:38:51 -0000 Authentication-Results: pb1.pair.com smtp.mail=mozo@mozo.jp; spf=permerror; sender-id=permerror Authentication-Results: pb1.pair.com header.from=mozo@mozo.jp; sender-id=permerror Received-SPF: error (pb1.pair.com: domain mozo.jp from 74.125.46.28 cause and error) X-PHP-List-Original-Sender: mozo@mozo.jp X-Host-Fingerprint: 74.125.46.28 yw-out-2324.google.com Received: from [74.125.46.28] ([74.125.46.28:42855] helo=yw-out-2324.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id A9/7F-30978-93C3CC94 for ; Thu, 26 Mar 2009 21:38:51 -0500 Received: by yw-out-2324.google.com with SMTP id 3so576363ywj.83 for ; Thu, 26 Mar 2009 19:38:44 -0700 (PDT) MIME-Version: 1.0 Received: by 10.231.12.138 with SMTP id x10mr365951ibx.16.1238121524117; Thu, 26 Mar 2009 19:38:44 -0700 (PDT) In-Reply-To: References: Date: Fri, 27 Mar 2009 11:38:44 +0900 Message-ID: To: Bas van Beek Cc: internals@lists.php.net Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Subject: Re: [PHP-DEV] request for comments on threadsafe / multi-thread enabled Embed2 SAPI From: mozo@mozo.jp (Moriyoshi Koizumi) Isn't it better to avoid any behaviour-changing #define's in a header file? I mean the following series of lines in php_embed2.h: /* we control char* lifetime of smart_str as we allow it to cross request boundaries */ #define SMART_STR_USE_REALLOC 1 /* we use bigger numbers than default as script output will most likely be bigger than anticipated for smart_str usage */ #define SMART_STR_PREALLOC 2048 #define SMART_STR_START_SIZE 2000 #include TSRM needs to be initialized just once on startup. It's not the thing that has to be initialized per thread my 2c, Moriyoshi On Fri, Mar 27, 2009 at 4:35 AM, Bas van Beek wrote: > Hi Guys, > > The Embed2 SAPI for embedded applications needing multi-thread enabled PH= P > scripting support can be inspected from the following repository: > > =A0 =A0 =A0 =A0http://svn.tobin.nl/public/php/embed2/trunk/ > > The original Embedded SAPI does not allow concurrent script runs and as s= uch > is less suited for multi-threaded applications . Also single threaded > applications > can benefit from the Embed2 SAPI as for each PHP script run, it is not > necessary to initialize and shutdown the entire PHP environment. > > Examples for embedding PHP using the Embed2 SAPI can be found in the > examples directory. > > The C example uses pthreads to showcase a typical posix implementation. > The C++ example uses the boost::thread library to showcase a cross platfo= rm > implementation. Build instructions / make files are also added for Linux,= OS > X and Windows > > If good enough I would like to donate the Embed2 SAPI to the PHP communit= y > using the standard PHP License and request a CVS account for adding it to > the source tree. > > The code has been tested to run on PHP-5.2.9 and PHP-5.3.0RC1 and was tes= ted > using Mac OS X, Debian Linux and Windows XP. > > kind regards, > > Bas van Beek > > >