diff --git a/desmume/src/libretro-common/include/rthreads/rthreads.h b/desmume/src/libretro-common/include/rthreads/rthreads.h index 3258ceef6..682fd6922 100644 --- a/desmume/src/libretro-common/include/rthreads/rthreads.h +++ b/desmume/src/libretro-common/include/rthreads/rthreads.h @@ -103,6 +103,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: * diff --git a/desmume/src/libretro-common/rthreads/rthreads.c b/desmume/src/libretro-common/rthreads/rthreads.c index 01cdc2701..2cac2909e 100644 --- a/desmume/src/libretro-common/rthreads/rthreads.c +++ b/desmume/src/libretro-common/rthreads/rthreads.c @@ -302,6 +302,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 too. +#ifndef USE_WIN32_THREADS + pthread_setname_np(thread->id, name); +#endif +} + /** * slock_new: *