SDL_WaitEventTimeout(3)
π SDL_WaitEventTimeout(3) π
okay bestie, welcome to the SDL3 FUNCTIONS corner of the manual, where we wait for events like it's the group chat and everyone's typing but nobody's sending. this one's called SDL_WaitEventTimeout and honestly? it's giving patient queen energy. β¨
πΈ NAME πΈ
SDL_WaitEventTimeout β wait until the specified timeout (in milliseconds) for the next available event.
like. she waits. but only for so long. she has boundaries. π
π SYNOPSIS π
#include <SDL3/SDL_events.h>
bool SDL_WaitEventTimeout(SDL_Event *event, Sint32 timeoutMS);
π¦ DESCRIPTION π¦
so here's the tea, fr fr. if event is not NULL, the next event gets removed from the queue and stored in the SDL_Event structure pointed to by event. yes, removed. like it never happened. it's yours now, bestie. π«Ά
and because this function may implicitly call SDL_PumpEvents(), you can only call this function in the thread that initialized the video subsystem. no cap. don't try to be cute and call it from some random thread, it's not that girl.
also, lowkey important: the timeout is not guaranteed β the actual wait time could be longer due to system scheduling. so if you set it to wait 500ms and it takes 700ms, that's not a bug, that's just the scheduler having main character energy of its own. π
π FUNCTION PARAMETERS π
eventβ theSDL_Eventstructure to be filled in with the next event from the queue, orNULL. yeah,NULLis allowed. she's flexible like that. πΈtimeoutMSβ the maximum number of milliseconds to wait for the next available event. maximum, bestie. see above. β³
β¨ RETURN VALUE β¨
- returns
trueif this got an event β slay, we ate π - returns
falseif the timeout elapsed without any events available β nothing came through, it's giving empty inbox π
π THREAD SAFETY π
this function should only be called on the main thread. periodt. π
β AVAILABILITY β
this function is available since SDL 3.2.0. so if you're on something older, bestie... update. π
π SEE ALSO π
and that's the whole page, no crumbs left. this was Simple Directmedia Layer, specifically SDL 3.4.18, and yes the date is baked into that footer too β consider this your cute lil sign-off from the girl who will absolutely explain file descriptors to you at 2am. go forth and wait for events responsibly. bye bestie!! ππβ¨π¦πΈπ π«Ά
π¦ where this page comes from
- fedora 43: SDL3-devel 3.4.18-1.fc43 Β· Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 OR MIT)
- fedora 43: SDL3-devel 3.4.18-1.fc43 Β· Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 OR MIT)
- fedora 44: SDL3-devel 3.4.18-1.fc44 Β· Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 OR MIT)
- fedora 44: SDL3-devel 3.4.18-1.fc44 Β· Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 OR MIT)
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms