diff options
Diffstat (limited to 'src/utils')
-rw-r--r-- | src/utils/sdl2helper.cpp | 6 | ||||
-rw-r--r-- | src/utils/sdl2helper.h | 2 | ||||
-rw-r--r-- | src/utils/sdlhelper.cpp | 6 | ||||
-rw-r--r-- | src/utils/sdlhelper.h | 2 |
4 files changed, 16 insertions, 0 deletions
diff --git a/src/utils/sdl2helper.cpp b/src/utils/sdl2helper.cpp index 4f99dc512..7648ccc2b 100644 --- a/src/utils/sdl2helper.cpp +++ b/src/utils/sdl2helper.cpp @@ -188,4 +188,10 @@ void SDL::initLogger() SDL2Logger::init(); } +void SDL::WaitThread(SDL_Thread *const thread) +{ + if (thread != nullptr) + SDL_WaitThread(thread, nullptr); +} + #endif // USE_SDL2 diff --git a/src/utils/sdl2helper.h b/src/utils/sdl2helper.h index 04a258014..089bbbfab 100644 --- a/src/utils/sdl2helper.h +++ b/src/utils/sdl2helper.h @@ -63,6 +63,8 @@ namespace SDL void makeCurrentContext(void *const context); void initLogger(); + + void WaitThread(SDL_Thread *const thread); } // namespace SDL #endif // USE_SDL2 diff --git a/src/utils/sdlhelper.cpp b/src/utils/sdlhelper.cpp index 821eb40a5..324779898 100644 --- a/src/utils/sdlhelper.cpp +++ b/src/utils/sdlhelper.cpp @@ -186,4 +186,10 @@ void SDL::initLogger() { } +void SDL::WaitThread(SDL_Thread *const thread) +{ + if (thread != nullptr && SDL_GetThreadID(thread) != 0u) + SDL_WaitThread(thread, nullptr); +} + #endif // USE_SDL2 diff --git a/src/utils/sdlhelper.h b/src/utils/sdlhelper.h index 5e8c31e15..abb3934cb 100644 --- a/src/utils/sdlhelper.h +++ b/src/utils/sdlhelper.h @@ -69,6 +69,8 @@ namespace SDL void makeCurrentContext(void *const context); void initLogger(); + + void WaitThread(SDL_Thread *const thread); } // namespace SDL #endif // USE_SDL2 |