Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <pthread.h>
- #include <zdb/zdb.h>
- URL_T url;
- ConnectionPool_T pool;
- void* closeCon()
- {
- ConnectionPool_stop(pool);
- ConnectionPool_free(&pool);
- URL_free(&url);
- return NULL;
- }
- int main(void)
- {
- // init connection
- url = URL_new("mysql://localhost/sdfsInt?user=root&password=foobar");
- pool = ConnectionPool_new(url);
- ConnectionPool_start(pool);
- // close connection, either "threaded" or unthreaded
- // unthreaded close works fine,
- // threaded connection close fails with:
- // Error in my_thread_global_end(): 1 threads didn't exit
- #if 0
- closeCon();
- #else
- pthread_t myThread;
- pthread_create(&myThread, NULL, closeCon, NULL);
- pthread_join(myThread, NULL);
- #endif
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement