21 #include "../../SDL_internal.h" 27 #include "../SDL_thread_c.h" 28 #include "../SDL_systhread.h" 34 #include <system_error> 52 thread->
handle = (
void *)
new std::thread(std::move(cpp_thread));
54 }
catch (std::system_error & ex) {
55 SDL_SetError(
"unable to start a C++ thread: code=%d; %s", ex.code(), ex.what());
57 }
catch (std::bad_alloc &) {
77 return GetCurrentThreadId();
84 if (current_thread_id == 0) {
85 std::lock_guard<std::mutex>
lock(next_thread_id_mutex);
86 current_thread_id = next_thread_id;
90 return current_thread_id;
122 std::thread * cpp_thread = (std::thread *) thread->
handle;
123 if (cpp_thread->joinable()) {
126 }
catch (std::system_error &) {
142 std::thread * cpp_thread = (std::thread *) thread->
handle;
143 if (cpp_thread->joinable()) {
144 cpp_thread->detach();
146 }
catch (std::system_error &) {
static void RunThread(void *args)
SDL_TLSData * SDL_Generic_GetTLSData()
int SDL_Generic_SetTLSData(SDL_TLSData *storage)
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
void SDL_SYS_WaitThread(SDL_Thread *thread)
SDL_threadID SDL_ThreadID(void)
GLuint const GLchar * name
void SDL_SYS_DetachThread(SDL_Thread *thread)
SDL_TLSData * SDL_SYS_GetTLSData()
int SDL_SYS_SetTLSData(SDL_TLSData *data)
void SDL_SYS_SetupThread(const char *name)
#define SDL_OutOfMemory()
int SDL_SYS_SetThreadPriority(SDL_ThreadPriority priority)
int SDL_SYS_CreateThread(SDL_Thread *thread, void *args)
void SDL_RunThread(void *data)
unsigned long SDL_threadID