mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-05-28 23:49:12 +00:00
Added SDL_GetThreadState
This commit is contained in:
parent
b7dac5072b
commit
ca4f5dd40d
6 changed files with 39 additions and 8 deletions
|
@ -102,6 +102,25 @@ typedef enum SDL_ThreadPriority {
|
||||||
SDL_THREAD_PRIORITY_TIME_CRITICAL
|
SDL_THREAD_PRIORITY_TIME_CRITICAL
|
||||||
} SDL_ThreadPriority;
|
} SDL_ThreadPriority;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The SDL thread state.
|
||||||
|
*
|
||||||
|
* SDL stores the current state of a thread in an atomic int.
|
||||||
|
* The current state of a thread can be checked by calling
|
||||||
|
* SDL_GetThreadState.
|
||||||
|
*
|
||||||
|
* \since This enum is available since SDL 3.1.3.
|
||||||
|
*
|
||||||
|
* \sa SDL_GetThreadState
|
||||||
|
*/
|
||||||
|
typedef enum SDL_ThreadState
|
||||||
|
{
|
||||||
|
SDL_THREAD_STATE_ALIVE,
|
||||||
|
SDL_THREAD_STATE_DETACHED,
|
||||||
|
SDL_THREAD_STATE_ZOMBIE,
|
||||||
|
SDL_THREAD_STATE_CLEANED,
|
||||||
|
} SDL_ThreadState;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The function passed to SDL_CreateThread() as the new thread's entry point.
|
* The function passed to SDL_CreateThread() as the new thread's entry point.
|
||||||
*
|
*
|
||||||
|
@ -422,6 +441,18 @@ extern SDL_DECLSPEC bool SDLCALL SDL_SetCurrentThreadPriority(SDL_ThreadPriority
|
||||||
*/
|
*/
|
||||||
extern SDL_DECLSPEC void SDLCALL SDL_WaitThread(SDL_Thread *thread, int *status);
|
extern SDL_DECLSPEC void SDLCALL SDL_WaitThread(SDL_Thread *thread, int *status);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the current state of a thread.
|
||||||
|
*
|
||||||
|
* \param thread the thread whose status you want to check.
|
||||||
|
* \returns the current state of a thread as defined in the SDL_ThreadState enum.
|
||||||
|
*
|
||||||
|
* \since This function is available since SDL 3.1.3.
|
||||||
|
*
|
||||||
|
* \sa SDL_ThreadState
|
||||||
|
*/
|
||||||
|
extern SDL_DECLSPEC SDL_ThreadState SDLCALL SDL_GetThreadState(SDL_Thread *thread);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Let a thread clean up on exit without intervention.
|
* Let a thread clean up on exit without intervention.
|
||||||
*
|
*
|
||||||
|
|
|
@ -1229,6 +1229,7 @@ SDL3_0.0.0 {
|
||||||
SDL_GetTrayEntryParent;
|
SDL_GetTrayEntryParent;
|
||||||
SDL_GetTrayMenuParentEntry;
|
SDL_GetTrayMenuParentEntry;
|
||||||
SDL_GetTrayMenuParentTray;
|
SDL_GetTrayMenuParentTray;
|
||||||
|
SDL_GetThreadState;
|
||||||
# extra symbols go here (don't modify this line)
|
# extra symbols go here (don't modify this line)
|
||||||
local: *;
|
local: *;
|
||||||
};
|
};
|
||||||
|
|
|
@ -1254,3 +1254,4 @@
|
||||||
#define SDL_GetTrayEntryParent SDL_GetTrayEntryParent_REAL
|
#define SDL_GetTrayEntryParent SDL_GetTrayEntryParent_REAL
|
||||||
#define SDL_GetTrayMenuParentEntry SDL_GetTrayMenuParentEntry_REAL
|
#define SDL_GetTrayMenuParentEntry SDL_GetTrayMenuParentEntry_REAL
|
||||||
#define SDL_GetTrayMenuParentTray SDL_GetTrayMenuParentTray_REAL
|
#define SDL_GetTrayMenuParentTray SDL_GetTrayMenuParentTray_REAL
|
||||||
|
#define SDL_GetThreadState SDL_GetThreadState_REAL
|
||||||
|
|
|
@ -1262,3 +1262,4 @@ SDL_DYNAPI_PROC(void,SDL_DestroyTray,(SDL_Tray *a),(a),)
|
||||||
SDL_DYNAPI_PROC(SDL_TrayMenu*,SDL_GetTrayEntryParent,(SDL_TrayEntry *a),(a),return)
|
SDL_DYNAPI_PROC(SDL_TrayMenu*,SDL_GetTrayEntryParent,(SDL_TrayEntry *a),(a),return)
|
||||||
SDL_DYNAPI_PROC(SDL_TrayEntry*,SDL_GetTrayMenuParentEntry,(SDL_TrayMenu *a),(a),return)
|
SDL_DYNAPI_PROC(SDL_TrayEntry*,SDL_GetTrayMenuParentEntry,(SDL_TrayMenu *a),(a),return)
|
||||||
SDL_DYNAPI_PROC(SDL_Tray*,SDL_GetTrayMenuParentTray,(SDL_TrayMenu *a),(a),return)
|
SDL_DYNAPI_PROC(SDL_Tray*,SDL_GetTrayMenuParentTray,(SDL_TrayMenu *a),(a),return)
|
||||||
|
SDL_DYNAPI_PROC(SDL_ThreadState,SDL_GetThreadState,(SDL_Thread *a),(a),return)
|
||||||
|
|
|
@ -456,6 +456,11 @@ void SDL_WaitThread(SDL_Thread *thread, int *status)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SDL_ThreadState SDL_GetThreadState(SDL_Thread *thread)
|
||||||
|
{
|
||||||
|
return (SDL_ThreadState)SDL_GetAtomicInt(&thread->state);
|
||||||
|
}
|
||||||
|
|
||||||
void SDL_DetachThread(SDL_Thread *thread)
|
void SDL_DetachThread(SDL_Thread *thread)
|
||||||
{
|
{
|
||||||
if (!thread) {
|
if (!thread) {
|
||||||
|
|
|
@ -44,14 +44,6 @@
|
||||||
#endif
|
#endif
|
||||||
#include "../SDL_error_c.h"
|
#include "../SDL_error_c.h"
|
||||||
|
|
||||||
typedef enum SDL_ThreadState
|
|
||||||
{
|
|
||||||
SDL_THREAD_STATE_ALIVE,
|
|
||||||
SDL_THREAD_STATE_DETACHED,
|
|
||||||
SDL_THREAD_STATE_ZOMBIE,
|
|
||||||
SDL_THREAD_STATE_CLEANED,
|
|
||||||
} SDL_ThreadState;
|
|
||||||
|
|
||||||
// This is the system-independent thread info structure
|
// This is the system-independent thread info structure
|
||||||
struct SDL_Thread
|
struct SDL_Thread
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue