You can call the mysql_list_processes() function to return a result set that describes the current server threads.
Syntax
MYSQL_RES *
mysql_list_processes(MYSQL *mysql)
Return values
A MYSQL_RES result set is returned for an execution success, and NULL is returned if an error occurred.
Errors
CR_COMMANDS_OUT_OF_SYNC: Commands were executed in an improper order.CR_SERVER_GONE_ERROR: The connection to the OBServer was disconnected.CR_SERVER_LOST: The connection to the server was lost during the query.CR_UNKNOWN_ERROR: An unknown error occurred.
Notes
The result set returned by this function is the same kind of information as that reported by mysqladmin processlist or a SHOW PROCESSLIST query.
After the call is completed, you must free the result set with mysql_free_result().
mysql_list_processes() is deprecated. Use mysql_real_query() instead.