From 5ed00d34aa248c3af60ba26a0a74866a15bdb704 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Mon, 9 Jan 2023 15:59:39 -0800 Subject: [PATCH] Document that condition variable mutexes can't be locked recursively. Fixes https://github.com/libsdl-org/SDL/issues/5497 --- include/SDL3/SDL_mutex.h | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/include/SDL3/SDL_mutex.h b/include/SDL3/SDL_mutex.h index 989dd0309..f8cab5b86 100644 --- a/include/SDL3/SDL_mutex.h +++ b/include/SDL3/SDL_mutex.h @@ -481,7 +481,9 @@ extern DECLSPEC int SDLCALL SDL_CondBroadcast(SDL_cond *cond); * `cond`. Once the condition variable is signaled, the mutex is re-locked and * the function returns. * - * The mutex must be locked before calling this function. + * The mutex must be locked before calling this function. Locking the + * mutex recursively (more than once) is not supported and leads to + * undefined behavior. * * This function is the equivalent of calling SDL_CondWaitTimeout() with a * time length of `SDL_MUTEX_MAXWAIT`. @@ -510,7 +512,9 @@ extern DECLSPEC int SDLCALL SDL_CondWait(SDL_cond *cond, SDL_mutex *mutex); * signaled or the time elapsed, the mutex is re-locked and the function * returns. * - * The mutex must be locked before calling this function. + * The mutex must be locked before calling this function. Locking the + * mutex recursively (more than once) is not supported and leads to + * undefined behavior. * * \param cond the condition variable to wait on * \param mutex the mutex used to coordinate thread access