Path: blob/master/thirdparty/sdl/thread/SDL_systhread.h
9903 views
/*1Simple DirectMedia Layer2Copyright (C) 1997-2025 Sam Lantinga <[email protected]>34This software is provided 'as-is', without any express or implied5warranty. In no event will the authors be held liable for any damages6arising from the use of this software.78Permission is granted to anyone to use this software for any purpose,9including commercial applications, and to alter it and redistribute it10freely, subject to the following restrictions:11121. The origin of this software must not be misrepresented; you must not13claim that you wrote the original software. If you use this software14in a product, an acknowledgment in the product documentation would be15appreciated but is not required.162. Altered source versions must be plainly marked as such, and must not be17misrepresented as being the original software.183. This notice may not be removed or altered from any source distribution.19*/20#include "SDL_internal.h"2122// These are functions that need to be implemented by a port of SDL2324#ifndef SDL_systhread_h_25#define SDL_systhread_h_2627#include "SDL_thread_c.h"2829// Set up for C function definitions, even when using C++30#ifdef __cplusplus31extern "C" {32#endif3334/* This function creates a thread, passing args to SDL_RunThread(),35saves a system-dependent thread id in thread->id, and returns 036on success.37*/38extern bool SDL_SYS_CreateThread(SDL_Thread *thread,39SDL_FunctionPointer pfnBeginThread,40SDL_FunctionPointer pfnEndThread);4142// This function does any necessary setup in the child thread43extern void SDL_SYS_SetupThread(const char *name);4445// This function sets the current thread priority46extern bool SDL_SYS_SetThreadPriority(SDL_ThreadPriority priority);4748/* This function waits for the thread to finish and frees any data49allocated by SDL_SYS_CreateThread()50*/51extern void SDL_SYS_WaitThread(SDL_Thread *thread);5253// Mark thread as cleaned up as soon as it exits, without joining.54extern void SDL_SYS_DetachThread(SDL_Thread *thread);5556// Initialize the global TLS data57extern void SDL_SYS_InitTLSData(void);5859// Get the thread local storage for this thread60extern SDL_TLSData *SDL_SYS_GetTLSData(void);6162// Set the thread local storage for this thread63extern bool SDL_SYS_SetTLSData(SDL_TLSData *data);6465// Quit the global TLS data66extern void SDL_SYS_QuitTLSData(void);6768// A helper function for setting up a thread with a stack size.69extern SDL_Thread *SDL_CreateThreadWithStackSize(SDL_ThreadFunction fn, const char *name, size_t stacksize, void *data);7071// Ends C function definitions when using C++72#ifdef __cplusplus73}74#endif7576#endif // SDL_systhread_h_777879