Name

mysql_thread_id( )

Synopsis

unsigned long mysql_thread_id(MYSQL *mysql)

This returns the thread identifier number for the current connection to MySQL. Thread identifiers can change if a connection is closed or restarted.

...
int thread = mysql_thread_id(mysql);
printf("Thread ID: %d \n", thread);
...

Get MySQL in a Nutshell now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.