unsigned long mysql_thread_id(MYSQL *mysql)
Returns the thread ID of the current connection. This value can
be used as an argument to
mysql_kill() to kill the thread.
If the connection is lost and you reconnect with
mysql_ping(), the thread ID
changes. This means you should not get the thread ID and store
it for later. You should get it when you need it.
The thread ID of the current connection.