MySQL Forums
Forum List  »  Connector/C++

Is mysql_query thread-safe if I init one mysql connection per thread?
Posted by: steven S
Date: May 21, 2012 10:15PM

what I want to know is that is mysql_query or other mysql function in C api thread-safe with the following conditions:

1. using the libmysqlclient.so but not the libmysqlclient_r.so
2. in every thread, call mysql_init and mysql_real_connect within the protect of an global mutex to get one mysql connection every thread
3. call mysql_query or other mysql function without the protect of the global mutex using each thread's own mysql connection

is this thread-safe ?

well I think it is, and from what I have tested, it seems it is thread-safe.

but I just not sure. can anyone tell me?

thank you very much

Options: ReplyQuote


Subject
Views
Written By
Posted
Is mysql_query thread-safe if I init one mysql connection per thread?
3398
May 21, 2012 10:15PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.