Document that video and input functions should be called on the main thread.

This is a hard requirement on Apple platforms and while most other platforms don't have a concept of main thread, all video and input functions should be called on the same thread.
This commit is contained in:
Sam Lantinga
2024-12-05 09:45:32 -08:00
parent fffa6c7a2b
commit bc4185c685
7 changed files with 407 additions and 103 deletions

View File

@@ -1034,9 +1034,7 @@ SDL_COMPILE_TIME_ASSERT(SDL_Event, sizeof(SDL_Event) == sizeof(((SDL_Event *)NUL
* polling or waiting for events (e.g. you are filtering them), then you must
* call SDL_PumpEvents() to force an event queue update.
*
* \threadsafety This should only be run in the thread that initialized the
* video subsystem, and for extra safety, you should consider
* only doing those things on the main thread in any case.
* \threadsafety This function should only be called on the main thread.
*
* \since This function is available since SDL 3.1.3.
*
@@ -1234,9 +1232,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_FlushEvents(Uint32 minType, Uint32 maxType)
* the queue, or NULL.
* \returns true if this got an event or false if there are none available.
*
* \threadsafety This should only be run in the thread that initialized the
* video subsystem, and for extra safety, you should consider
* only doing those things on the main thread in any case.
* \threadsafety This function should only be called on the main thread.
*
* \since This function is available since SDL 3.1.3.
*
@@ -1260,9 +1256,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_PollEvent(SDL_Event *event);
* \returns true on success or false if there was an error while waiting for
* events; call SDL_GetError() for more information.
*
* \threadsafety This should only be run in the thread that initialized the
* video subsystem, and for extra safety, you should consider
* only doing those things on the main thread in any case.
* \threadsafety This function should only be called on the main thread.
*
* \since This function is available since SDL 3.1.3.
*
@@ -1292,9 +1286,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_WaitEvent(SDL_Event *event);
* \returns true if this got an event or false if the timeout elapsed without
* any events available.
*
* \threadsafety This should only be run in the thread that initialized the
* video subsystem, and for extra safety, you should consider
* only doing those things on the main thread in any case.
* \threadsafety This function should only be called on the main thread.
*
* \since This function is available since SDL 3.1.3.
*