Expose current worker id to c-files

This commit is contained in:
Johan Wikman 2017-04-26 13:17:23 +03:00
parent c8c2822c7b
commit 728c780187
2 changed files with 14 additions and 0 deletions

View File

@ -69,6 +69,15 @@ MXS_WORKER* mxs_worker_get(int worker_id);
*/
int mxs_worker_id(MXS_WORKER* pWorker);
/**
* Return the id of the worker.
*
* @return The id of the worker.
*
* @attention If there is no current worker, then -1 will be returned.
*/
int mxs_worker_get_current_id();
/**
* Post a message to a worker.
*

View File

@ -512,6 +512,11 @@ MXS_WORKER* mxs_worker_get(int worker_id)
return Worker::get(worker_id);
}
int mxs_worker_get_current_id()
{
return Worker::get_current_id();
}
Worker* Worker::get_current()
{
Worker* pWorker = NULL;