I'm using libmysql in a simple multithreaded app which will run on a uni-core embedded system processor. I read here that the client library is almost thread-safe.
Do I need to serialise my app (say, with a mutex)?
I'm using libmysql in a simple multithreaded app which will run on a uni-core embedded system processor. I read here that the client library is almost thread-safe.
Do I need to serialise my app (say, with a mutex)?
Depends on what you're doing. In a simple scenario you'd just link against
libmysqlclient_r
and make sure you don't share a connection with multiple threads nor execute multiple queries "simultaneously" on a single connection.Other requirements:
mysql_library_init()
to initialise the MySQL library;mysql_thread_init()
to initialise thread-specific variables before using any MySQL related functions;mysql_thread_end()
.If your program is respecting these limitations, MySQL is your friend.