SDL_WaitSemaphore(3)

✨ NAME ✨

SDL_WaitSemaphore(3) β€” bestie, this is the SDL3 FUNCTIONS manual page for SDL_WaitSemaphore. It waits until a semaphore has a positive value, then decrements it. Periodt. πŸ’…


πŸŽ€ SYNOPSIS πŸŽ€

#include <SDL3/SDL_mutex.h>

void SDL_WaitSemaphore(SDL_Semaphore *sem);

🌸 DESCRIPTION 🌸

Okay so SDL_WaitSemaphore literally suspends the calling thread until the semaphore pointed to by sem has a positive value, and then it atomically decrements the semaphore value. No cap. ✨

This function is the equivalent of calling SDL_WaitSemaphoreTimeout() with a time length of -1. That's the tea. πŸ«–

πŸ’– FUNCTION PARAMETERS πŸ’–

  • sem β€” the semaphore wait on. that's it, that's the param. πŸŽ€

πŸ”’ THREAD SAFETY πŸ”’

It is safe to call this function from any thread. So yes bestie, take it anywhere, it's thread-safe. πŸ‘‘

⭐ AVAILABILITY ⭐

This function is available since SDL 3.2.0. iconic. 🌈

πŸ‘€ SEE ALSO πŸ‘€


okay bye bestie! πŸ’… this page came from Simple Directmedia Layer, version SDL 3.4.18. the footer doesn't list a date, so I'm not inventing one β€” mwah 🫢

πŸ“¦ where this page comes from