From d2689fc1683a18bfc9e0af9b5dcbe623a28b6e02 Mon Sep 17 00:00:00 2001 From: Romain Vimont Date: Sun, 31 Jan 2021 18:54:52 +0100 Subject: [PATCH] Expose thread id --- app/src/util/thread.c | 5 +++++ app/src/util/thread.h | 4 ++++ 2 files changed, 9 insertions(+) diff --git a/app/src/util/thread.c b/app/src/util/thread.c index bb4feb62..1fc6bb19 100644 --- a/app/src/util/thread.c +++ b/app/src/util/thread.c @@ -64,6 +64,11 @@ sc_mutex_unlock(sc_mutex *mutex) { #endif } +sc_thread_id +sc_thread_get_id(void) { + return SDL_ThreadID(); +} + bool sc_cond_init(sc_cond *cond) { SDL_cond *sdl_cond = SDL_CreateCond(); diff --git a/app/src/util/thread.h b/app/src/util/thread.h index 5fbaf3c1..85a2aca0 100644 --- a/app/src/util/thread.h +++ b/app/src/util/thread.h @@ -12,6 +12,7 @@ typedef struct SDL_mutex SDL_mutex; typedef struct SDL_cond SDL_cond; typedef int sc_thread_fn(void *); +typedef unsigned int sc_thread_id; typedef struct sc_thread { SDL_Thread *thread; @@ -44,6 +45,9 @@ sc_mutex_lock(sc_mutex *mutex); void sc_mutex_unlock(sc_mutex *mutex); +sc_thread_id +sc_thread_get_id(void); + bool sc_cond_init(sc_cond *cond);