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.

Ethan...

On Sep 2, 2010, at 12:03 AM, Markus Hoenicka wrote:

> Ethan Funk <et...@redmountainradio.com> was heard to say:
> 
>> Even with libdbi linked against the libmysqlclient_r library, the API is not 
>> thread safe with out the mysql_thread_start() and mysql_thread_end() calls 
>> on a **shared** connection, so including my change would not **hurt**.   
>> Linking agains the non _r library and you can't even run different 
>> connection on different threads.
>> 
> 
> Would it be feasible to tell the libdbi driver how your app uses threads by 
> means of a driver option? Something like mysql_one_conn_per_thread? This way, 
> the driver could use some optimizations like yours which apply only under 
> these particular conditions.
> 
> 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