-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Description
There's a few functions in SDL that are documented to be safe to call from any thread which just check a static variable and then do initialization if it's not been set. For example SDL_GetTicks/NS, all the cpu feature functions, and (although not documented to be thread safe) SDL_GetBasePath, SDL_IsMainThread (doesn't init but doesn't use atomic) etc. These should probably use SDL_InitState or at least an atomic? I can make a PR, but first I wanted to check if there's a reason they're not doing that already
(ofc GetTicks has to be fast and atomics are slow, but in that case i think it's probably ok to just check the static and use atomics only for initialization, since SDL's atomics do full sync. tho relaxed atomic would be better for platforms that can do that fast)