mirror of
https://github.com/libretro/libretro-common.git
synced 2024-06-23 14:43:24 -04:00
rthreads: Add the ability to name threads
This commit is contained in:
parent
551f8ea381
commit
6e1affe1cf
|
@ -101,6 +101,16 @@ void sthread_join(sthread_t *thread);
|
|||
*/
|
||||
bool sthread_isself(sthread_t *thread);
|
||||
|
||||
/**
|
||||
* sthread_set_name:
|
||||
* @thread : pointer to thread object
|
||||
* @name : name to define for the thread (at most
|
||||
* 15 bytes)
|
||||
*
|
||||
* Set the thread name, useful for debugging.
|
||||
*/
|
||||
void sthread_setname(sthread_t *thread, const char *name);
|
||||
|
||||
/**
|
||||
* slock_new:
|
||||
*
|
||||
|
|
|
@ -318,6 +318,24 @@ bool sthread_isself(sthread_t *thread)
|
|||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
* sthread_set_name:
|
||||
* @thread : pointer to thread object
|
||||
* @name : name to define for the thread (at most
|
||||
* 15 bytes)
|
||||
*
|
||||
* Set the thread name, useful for debugging.
|
||||
*/
|
||||
void sthread_setname(sthread_t *thread, const char *name)
|
||||
{
|
||||
if (!thread)
|
||||
return;
|
||||
// TODO: implement that for Windows and Apple too.
|
||||
#ifdef __linux__
|
||||
pthread_setname_np(thread->id, name);
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
* slock_new:
|
||||
*
|
||||
|
|
Loading…
Reference in a new issue