On 26-06-13 08:51, 马佳佳 wrote:
Now I am doing a project ,use qt and libzdb,but I donnot know how to use
libzdb in the multi-thread environment . as I find the most time is the connectpool_start() ,and at the end of the thread I must call url_free() and connectpool_free .Is is right? I hope someone who can help me!
I use libzdb in a multi-threaded setup. Creating and cleaning up the connection pool is done in the main thread, so the pool is shared between all threads.
Worker threads only need to do:
ConnectionPool_getConnection(pool)
use the connection and do
Connection_close(connection);
once they are done with it so it can return to the pool
No need to worry about locking since that is libzdb's job.
Starting a separate pool for each thread invalidates the use of a connection-pool.