Synopsis
unsigned long mysql_thread_id(MYSQL *mysql)
This function returns the thread identifier number for the
current connection to MySQL. Thread identifiers can change if a
connection is closed or restarted. Here is an example:
...
int thread = mysql_thread_id(mysql);
printf("Thread ID: %d \n", thread);
...