Expose thread id

This commit is contained in:
Romain Vimont 2021-01-31 18:54:52 +01:00
parent f6320c7e31
commit d2689fc168
2 changed files with 9 additions and 0 deletions

View file

@ -64,6 +64,11 @@ sc_mutex_unlock(sc_mutex *mutex) {
#endif #endif
} }
sc_thread_id
sc_thread_get_id(void) {
return SDL_ThreadID();
}
bool bool
sc_cond_init(sc_cond *cond) { sc_cond_init(sc_cond *cond) {
SDL_cond *sdl_cond = SDL_CreateCond(); SDL_cond *sdl_cond = SDL_CreateCond();

View file

@ -12,6 +12,7 @@ typedef struct SDL_mutex SDL_mutex;
typedef struct SDL_cond SDL_cond; typedef struct SDL_cond SDL_cond;
typedef int sc_thread_fn(void *); typedef int sc_thread_fn(void *);
typedef unsigned int sc_thread_id;
typedef struct sc_thread { typedef struct sc_thread {
SDL_Thread *thread; SDL_Thread *thread;
@ -44,6 +45,9 @@ sc_mutex_lock(sc_mutex *mutex);
void void
sc_mutex_unlock(sc_mutex *mutex); sc_mutex_unlock(sc_mutex *mutex);
sc_thread_id
sc_thread_get_id(void);
bool bool
sc_cond_init(sc_cond *cond); sc_cond_init(sc_cond *cond);