From 40833d25262552fe96dec5acd3870d79f08f1456 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Mon, 9 Jan 2023 09:01:41 -0800 Subject: [PATCH] Documented thread starvation issue raised in https://github.com/libsdl-org/SDL/pull/7023 --- include/SDL3/SDL_atomic.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/include/SDL3/SDL_atomic.h b/include/SDL3/SDL_atomic.h index 3a332a0554..5e29ba007a 100644 --- a/include/SDL3/SDL_atomic.h +++ b/include/SDL3/SDL_atomic.h @@ -78,6 +78,11 @@ extern "C" { * minimize the code executed inside an atomic lock and never do * expensive things like API or system calls while holding them. * + * They are also vulnerable to starvation if the thread holding + * the lock is lower priority than other threads and doesn't get + * scheduled. In general you should use mutexes instead, since + * in general they have better performance and contention behavior. + * * The atomic locks are not safe to lock recursively. * * Porting Note: