Ethan Funk <et...@redmountainradio.com> was heard to say:

> With out the ability to tell libdbi that a new thread is using it,  
> through some API function call, and then when it is done, such that  
> libdbi driver can pass that down to mysqlclient, mysqlclient will  
> not be thread safe.  At least with the one thread per connection  
> limitation, you can use libdbi either with the non- _r library on a  
> single thread or with the _r library on many threads as long as each  
> thread has it's own connection so that libdbi can use the connection  
> open/close as a place to notify libmysqlclient about the start and  
> end of threading access.
>
> Maybe the way to do this is to bend the functionality of  
> dbi_conn_set_option a bit, such that at the mysql driver, setting an  
> option, "enter_thread" and "exit_thread" for example, would cause  
> the driver to call mysql_thread_start and mysql_thread_end.  As long  
> as it is documented that these options only need to be used in extra  
> threads - the original thread that opened the connection has this  
> done for it already by libmysqlclient, and by my code change to the  
> libdby mysql driver on connection close to handle the libmysqlclient  
> bug.
>

I've had a brief look at the MySQL docs. As far as I understand the  
situation, calling mysql_thread_start() explicitly should not be  
required at all, and calling mysql_thread_end() only once, just before  
your app terminates the thread. I reckon it would make more sense to  
add a libdbi function for that purpose. Does anyone know how other  
client libraries handle threading issues? Do other libs require  
calling init or end routines in threads? Needless to say, in drivers  
which do not support threading this new function would be a no-op.

regards,
Markus

-- 
Markus Hoenicka
http://www.mhoenicka.de
AQ score 38



------------------------------------------------------------------------------
This SF.net Dev2Dev email is sponsored by:

Show off your parallel programming skills.
Enter the Intel(R) Threading Challenge 2010.
http://p.sf.net/sfu/intel-thread-sfd
_______________________________________________
Libdbi-drivers-devel mailing list
Libdbi-drivers-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libdbi-drivers-devel

Reply via email to