Skip to content

Commit

Permalink
Sync SDL3 header -> wiki
Browse files Browse the repository at this point in the history
  • Loading branch information
SDLWikiBot committed Dec 26, 2024
1 parent a34621c commit a4ac8ca
Show file tree
Hide file tree
Showing 7 changed files with 50 additions and 19 deletions.
10 changes: 5 additions & 5 deletions SDL3/SDL_GetThreadState.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@ SDL_ThreadState SDL_GetThreadState(SDL_Thread *thread);
## Function Parameters
| | | |
| -------------------------- | ---------- | ------------------------------------------ |
| [SDL_Thread](SDL_Thread) * | **thread** | the thread whose status you want to check. |
| | | |
| -------------------------- | ---------- | -------------------- |
| [SDL_Thread](SDL_Thread) * | **thread** | the thread to query. |
## Return Value
([SDL_ThreadState](SDL_ThreadState)) Returns the current state of a thread
as defined in the [SDL_ThreadState](SDL_ThreadState) enum.
([SDL_ThreadState](SDL_ThreadState)) Returns the current state of a thread,
or [SDL_THREAD_UNKNOWN](SDL_THREAD_UNKNOWN) if the thread isn't valid.
## Version
Expand Down
8 changes: 8 additions & 0 deletions SDL3/SDL_THREAD_ALIVE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
###### (This is the documentation for SDL3, which is the current stable version. [SDL2](https://wiki.libsdl.org/SDL2/) was the previous version!)
# SDL_THREAD_ALIVE

Please refer to [SDL_ThreadState](SDL_ThreadState) for details.

----
[CategoryAPI](CategoryAPI), [CategoryAPIEnumerators](CategoryAPIEnumerators)

8 changes: 8 additions & 0 deletions SDL3/SDL_THREAD_COMPLETE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
###### (This is the documentation for SDL3, which is the current stable version. [SDL2](https://wiki.libsdl.org/SDL2/) was the previous version!)
# SDL_THREAD_COMPLETE

Please refer to [SDL_ThreadState](SDL_ThreadState) for details.

----
[CategoryAPI](CategoryAPI), [CategoryAPIEnumerators](CategoryAPIEnumerators)

8 changes: 8 additions & 0 deletions SDL3/SDL_THREAD_DETACHED.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
###### (This is the documentation for SDL3, which is the current stable version. [SDL2](https://wiki.libsdl.org/SDL2/) was the previous version!)
# SDL_THREAD_DETACHED

Please refer to [SDL_ThreadState](SDL_ThreadState) for details.

----
[CategoryAPI](CategoryAPI), [CategoryAPIEnumerators](CategoryAPIEnumerators)

8 changes: 8 additions & 0 deletions SDL3/SDL_THREAD_UNKNOWN.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
###### (This is the documentation for SDL3, which is the current stable version. [SDL2](https://wiki.libsdl.org/SDL2/) was the previous version!)
# SDL_THREAD_UNKNOWN

Please refer to [SDL_ThreadState](SDL_ThreadState) for details.

----
[CategoryAPI](CategoryAPI), [CategoryAPIEnumerators](CategoryAPIEnumerators)

11 changes: 5 additions & 6 deletions SDL3/SDL_ThreadState.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,16 @@ Defined in [<SDL3/SDL_thread.h>](https://github.com/libsdl-org/SDL/blob/main/inc
```c
typedef enum SDL_ThreadState
{
SDL_THREAD_STATE_ALIVE,
SDL_THREAD_STATE_DETACHED,
SDL_THREAD_STATE_ZOMBIE,
SDL_THREAD_STATE_CLEANED,
SDL_THREAD_UNKNOWN, /**< The thread is not valid */
SDL_THREAD_ALIVE, /**< The thread is currently running */
SDL_THREAD_DETACHED, /**< The thread is detached and can't be waited on */
SDL_THREAD_COMPLETE, /**< The thread has finished and should be cleaned up with SDL_WaitThread() */
} SDL_ThreadState;
```

## Remarks

SDL stores the current state of a thread in an atomic int. The current
state of a thread can be checked by calling
The current state of a thread can be checked by calling
[SDL_GetThreadState](SDL_GetThreadState).

## Version
Expand Down
16 changes: 8 additions & 8 deletions SDL3/SDL_WaitThread.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,23 +15,23 @@ void SDL_WaitThread(SDL_Thread *thread, int *status);
## Function Parameters
| | | |
| -------------------------- | ---------- | -------------------------------------------------------------------------------------------------------------------------------------------- |
| [SDL_Thread](SDL_Thread) * | **thread** | the [SDL_Thread](SDL_Thread) pointer that was returned from the [SDL_CreateThread](SDL_CreateThread)() call that started this thread. |
| int * | **status** | pointer to an integer that will receive the value returned from the thread function by its 'return', or NULL to not receive such value back. |
| | | |
| -------------------------- | ---------- | -------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [SDL_Thread](SDL_Thread) * | **thread** | the [SDL_Thread](SDL_Thread) pointer that was returned from the [SDL_CreateThread](SDL_CreateThread)() call that started this thread. |
| int * | **status** | a pointer filled in with the value returned from the thread function by its 'return', or -1 if the thread has been detached or isn't valid, may be NULL. |
## Remarks
Threads that haven't been detached will remain (as a "zombie") until this
function cleans them up. Not doing so is a resource leak.
Threads that haven't been detached will remain until this function cleans
them up. Not doing so is a resource leak.
Once a thread has been cleaned up through this function, the
[SDL_Thread](SDL_Thread) that references it becomes invalid and should not
be referenced again. As such, only one thread may call
[SDL_WaitThread](SDL_WaitThread)() on another.
The return code for the thread function is placed in the area pointed to by
`status`, if `status` is not NULL.
The return code from the thread function is placed in the area pointed to
by `status`, if `status` is not NULL.
You may not wait on a thread that has been used in a call to
[SDL_DetachThread](SDL_DetachThread)(). Use either that function or this
Expand Down

0 comments on commit a4ac8ca

Please sign in to comment.