Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:4898 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 69688 invoked by uid 1010); 20 Oct 2003 22:10:55 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 69654 invoked from network); 20 Oct 2003 22:10:55 -0000 Received: from unknown (HELO colo.lerdorf.com) (66.198.51.121) by pb1.pair.com with SMTP; 20 Oct 2003 22:10:55 -0000 Received: from h009062.203112.miinet.jp (h009062.203112.miinet.jp [203.112.9.62]) by colo.lerdorf.com (8.12.10/8.12.10/Debian-4) with ESMTP id h9KMAiP1021743; Mon, 20 Oct 2003 15:10:45 -0700 Date: Mon, 20 Oct 2003 15:10:44 -0700 (PDT) To: netcat cc: internals@lists.php.net In-Reply-To: <3F943512.6020708@abox.co.il> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Spam-Status: No, hits=-4.9 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=2.60 X-Spam-Checker-Version: SpamAssassin 2.60 (1.212-2003-09-23-exp) on colo Subject: Re: [PHP-DEV] request for thread safety advice From: rasmus@lerdorf.com (Rasmus Lerdorf) References: <3F943512.6020708@abox.co.il> 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 :) > > >