SDL_WaitConditionTimeout(3)
π SDL_WaitConditionTimeout π
okay bestie, so you know how there's a whole SDL3 FUNCTIONS manual situation? yeah, this is one of those pages, and it's literally about waiting for a condition variable to get signaled β or just... giving up after a while. the vibe is patience with a deadline. π°οΈβ¨
πΈ NAME πΈ
SDL_WaitConditionTimeout β wait until a condition variable is signaled, or until a certain amount of time has passed. no cap. β³
β¨ SYNOPSIS β¨
#include <SDL3/SDL_mutex.h>
bool SDL_WaitConditionTimeout(SDL_Condition *cond,
SDL_Mutex *mutex, Sint32 timeoutMS);
π DESCRIPTION π
okay so here's the tea. this function unlocks the mutex you hand it and then it just... waits. it's waiting for another thread to hit it with SDL_SignalCondition() or SDL_BroadcastCondition() on the condition variable cond β or for the specified time to run out. whichever comes first, bestie. once the condition variable gets signaled or the clock says "we're done here", the mutex gets re-locked and the function returns. π
π¨ real talk though: the mutex must be locked before you call this function. that's non-negotiable. and do NOT lock the mutex recursively (like, more than once). it is not supported and it leads to undefined behavior. not the cute mysterious kind of undefined. the bad kind. π
π«Ά FUNCTION PARAMETERS π«Ά
condβ the condition variable you're waiting on. your main character. πmutexβ the mutex that coordinates thread access. it keeps everybody in line fr fr. πtimeoutMSβ the maximum time to wait, measured in milliseconds, or-1if you want to wait indefinitely. yes,-1means "forever, bestie." π
β RETURN VALUE β
- returns
trueif the condition variable got signaled π - returns
falseif the condition was not signaled within the allotted time π
π§ THREAD SAFETY π§
it is safe to call this function from any thread. every thread. all of them. go off. π¦
πΈ AVAILABILITY πΈ
this function is available since SDL 3.2.0. iconic behavior honestly. β¨
π₯ SEE ALSO π₯
and that's the whole page, bestie!! π go forth and synchronize your threads responsibly, mwah π
this little love letter to concurrency comes to you courtesy of Simple Directmedia Layer, version SDL 3.4.18 β SDL_WaitConditionTimeout(3), signing off π«Άβ¨
π¦ 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