Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:4899 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 26510 invoked by uid 1010); 21 Oct 2003 00:07:05 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 26485 invoked from network); 21 Oct 2003 00:07:05 -0000 Received: from unknown (HELO mailout05.sul.t-online.com) (194.25.134.82) by pb1.pair.com with SMTP; 21 Oct 2003 00:07:05 -0000 Received: from fwd06.aul.t-online.de by mailout05.sul.t-online.com with smtp id 1ABk39-0001jd-00; Tue, 21 Oct 2003 02:06:59 +0200 Received: from vega.php.net (TzkiksZaoePA6sGIyBJALwFMJElHah8fCE1I+eQG4gPo4t1M0bb0og@[217.229.55.7]) by fmrl06.sul.t-online.com with esmtp id 1ABk2t-0thmHA0; Tue, 21 Oct 2003 02:06:43 +0200 Message-ID: <6.0.0.22.0.20031021015807.03808138@127.0.0.1> X-Sender: (Unverified) X-Mailer: QUALCOMM Windows Eudora Version 6.0.0.22 Date: Tue, 21 Oct 2003 02:06:41 +0200 To: Rasmus Lerdorf Cc: internals@lists.php.net In-Reply-To: References: <3F943512.6020708@abox.co.il> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; format=flowed X-Seen: false X-ID: TzkiksZaoePA6sGIyBJALwFMJElHah8fCE1I+eQG4gPo4t1M0bb0og@t-dialin.net Subject: Re: [PHP-DEV] request for thread safety advice From: thetaphi@php.net (Uwe Schindler) nice for that would be some macros (somewhere in zend????) which help in the following way (the ext_skel should generate the code, too): a) define a global library identifier (for all blocks that should not run at the same time) zend_create_mutex(identifier) b) use some code like: zend_start_synchronized(identifier) { ... ... } zend_end_synchronized(identifier); (Same construct like zend_try). Without ZTS this macros should be empty... As I am the developer of the NSAPI SAPI (which runs only with ZTS) I would like to have a GD extension where alle PHP_FUNCTIONs exported from there should have such Java-like "synchronized" blocks. Uwe At 00:10 21.10.2003, you wrote: >If the library you are wrapping is not threadsafe, one approach is to >simply not worry about it and just mark your extension as not being safe >to use in a threaded environment. The majority of people use PHP in a >non-threaded environment anyway. > >If you want to be nice to the folks who do use PHP in a threaded >environment, you can look into adding a semaphore lock around the calls >into the code that is not threadsafe. Such a semaphore lock makes sure >that only 1 thread at a time can enter the code. Other threads sit around >and wait until it is their turn. > >-Rasmus > >On Mon, 20 Oct 2003, netcat wrote: > > > Hi, internals. > > > > Please send me (post here i mean) a few links about > > 1. thread safety in general > > 2. thread saftey in php > > 3. I'm doing wrapper for librep wich is not thread > > safe (so mailing archives say). Do I need to know > > something special ? > > > > > > After doing some googling i found thise for #1 > > http://www.unix.org/version2/whatsnew/threads.html > > http://www.unix.org/version2/whatsnew/threadsref.html > > is that a good reading ? > > > > any better suggestions for google requests than thise : > > c thread safety -mail -archive -lists > > c thread safety tutor > > ? > > > > I couldn't find anything for #2 but it's not less > > important than #1 :) > > > > > > > >-- >PHP Internals - PHP Runtime Development Mailing List >To unsubscribe, visit: http://www.php.net/unsub.php ----- Uwe Schindler thetaphi@php.net - http://www.php.net NSAPI SAPI developer Erlangen, Germany