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

Reply via email to