Return-Path: Delivered-To: new-httpd-archive@hyperreal.org Received: (qmail 19955 invoked by uid 6000); 12 Dec 1997 22:50:53 -0000 Received: (qmail 19949 invoked from network); 12 Dec 1997 22:50:50 -0000 Received: from michael.webdevelop.com (root@207.239.62.10) by taz.hyperreal.org with SMTP; 12 Dec 1997 22:50:50 -0000 Received: from smc1.dorsai.org (slip-32-100-113-123.ny.us.ibm.net [32.100.113.123]) by michael.webdevelop.com (8.8.5/8.7.3) with SMTP id RAA08173 for ; Fri, 12 Dec 1997 17:50:18 -0500 Message-Id: <199712122250.RAA08173@michael.webdevelop.com> Comments: Authenticated sender is From: "Shane Caraveo" To: new-httpd@apache.org Date: Fri, 12 Dec 1997 17:41:54 -05:0 MIME-Version: 1.0 Content-type: text/plain; charset=US-ASCII Content-transfer-encoding: 7BIT Subject: RE: thread safe modules In-reply-to: X-mailer: Pegasus Mail for Win32 (v2.54) Sender: new-httpd-owner@apache.org Precedence: bulk Reply-To: new-httpd@apache.org Hmm, while thread saftey is a pain in the butt when moving from unix to windows, in php 3 we came up with a (as yet unfinish and untested) seemingly easy way to do it. While you would have to look at the code to get all the specifics, we put our globals and static vars into a structure, did a number of ifdefs, used the TLS api in msvc5, and put a define GLOBAL() around all our globals. Now, when it is compiled in vc5, it should be thread safe (except we still have work to do on the flex generated stuff), and when compiled on unix it is just its regular old unchanged self. We then use DllMain to set up our thread local index, and allocate memory per thread for the global structure. Of course we'll take a little performance hit on the windows side (a call to get the thread index in each function that uses a global), and c++ would probably be better, but it saves us from a ground up rewrite of what has been done so far, and keeps compilability across platforms. Shane