Quoting Rainer Gerhards <[EMAIL PROTECTED]>:

> You need to be very careful. Not just libdbi's own thread safety must be
> considered, but the thread safety of the drivers. In short, IMHO it is
> not possibly to correctly assume that a libdbi call, at least on the
> same connection handle, is thread safe. For example, this will always
> fail with MySQL. To the best of my knowledge libdbi does not use mutexes
> itself to avoid threading pitfalls on the driver layer (and I think this
> is a good design-decision, as most apps do not need these and they cost
> performance).
>
> So your app must make sure that it calls into the drivers only in a
> thread safe way. In short: you must mutex-protect these cases yourself.

I have to admit that I do not have any experience in terms of  
thread-safe programming, but as always I'm trying to understand. Is  
the problem you mentioned MySQL specific? Is there anything we can (or  
should?) do about it in libdbi or in the driver? If I understand  
correctly, the best way to avoid problems is to use one connection  
handle per thread. Is this solution applicable to most programs, or  
does it have a performance penalty that most apps want to avoid?

Maybe it's worthwhile to add a section about threading issues to the  
programmer's guide? Being a non-expert myself, I'd greatly appreciate  
contributions from those "in the know".

regards,
Markus


-- 
Markus Hoenicka
[EMAIL PROTECTED]
(Spam-protected email: replace the quadrupeds with "mhoenicka")
http://www.mhoenicka.de


-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
libdbi-users mailing list
libdbi-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libdbi-users

Reply via email to