Okay, so I've done some more research into this. Apparently, I'm not the only one with this
problem:
I wrote a standalone "C" app using VS2005 against libmysql, and verified that after closing a database, those same threads are still left laying around. So something in the mysql client library is causing this. I looked through the mysql.h header file and found entries for initializing and terminating a thread:
Code: Select all
/*
Set up and bring down a thread; these function should be called
for each thread in an application which opens at least one MySQL
connection. All uses of the connection(s) should be between these
function calls.
*/
my_bool STDCALL mysql_thread_init(void);
void STDCALL mysql_thread_end(void);
BINGO!! I thought to myself; just make sure I call that mysql_thread_end() method, and those pesky little threads will go away. Unfortunately, that's not how it's working. So this is obviously something either I'm doing wrong or something wrong in the mysql library, but it boggles my mind that more people aren't running into this.. Or are you running into it and just don't know?
Note one difference between the Borland executable and the Microsoft one is that the Microsoft executable will still close with the running threads, whereas the Borland one won't.