SDL_WaitProcess(3)
β¨ SDL_WaitProcess(3) β¨
okay bestie come SIT with me because we're doing SDL_WaitProcess from the SDL3 FUNCTIONS lineup and honestly? it's giving "chill little function with one giant trap" π
π NAME π
SDL_WaitProcess β wait for a process to finish. that's it, that's the whole job, no cap. π«Ά
πΈ SYNOPSIS πΈ
#include <SDL3/SDL_process.h>
bool SDL_WaitProcess(SDL_Process *process, bool block, int *exitcode);
π¦ DESCRIPTION π¦
so like. you can call this thing multiple times to just keep checking on the status of a process. it's not a one-and-done situation, she's reusable, she's flexible, she's the moment β¨
the exit code you get back will be one of these three vibes:
- the actual exit code of the process, if it terminated normally π
- a negative signal, if it terminated because of a signal π
- or
-255otherwise π
and here's the key part: if the process is still running, the exit code will not be changed. so don't come for her, she didn't touch it.
now for the part where you need to pay attention, bestie. if you created a process with standard output piped to the application (pipe_stdio being true), then you must read all of the process output before you call SDL_WaitProcess(). if you don't do this? the process might be blocked indefinitely waiting for output to be read, and SDL_WaitProcess() will never return true. like, ever. forever stuck. not the vibe. π
fr fr: read your pipe output first. do not skip this step. this is the whole plot twist of this manpage.
π§ FUNCTION PARAMETERS π§
processβ the process you're waiting on. the one and only. πblockβ iftrue, block until the process finishes; otherwise, just report on the process' status. so like, do you wanna sit and wait, or do you wanna peek and go? π«£exitcodeβ a pointer that gets filled in with the process exit code if the process has exited. may beNULL. yeah she's optional, she's low-maintenance. π
β RETURN VALUE β
returns true if the process exited, false otherwise. binary queen. slay. π
π THREAD SAFETY π
this function is not thread safe. so don't be out here sharing her across threads, she's not built for that drama. π βοΈ
π AVAILABILITY π
this function is available since SDL 3.2.0. so if you're on anything older, she's not there yet, sorry babe. β¨
π₯ SEE ALSO π₯
go read those too, iykyk. the whole process saga is a journey and these are her besties. π«Ά
and that's the whole page, bestie. take care of your pipes, check your exit codes, and remember: multiple calls are fine, blocked processes are not. periodt. π
sending you off with love from the Simple Directmedia Layer crew β this is SDL 3.4.18 energy, dated in the classic SDL_WaitProcess(3) style, and yes the version number goes at the bottom like a little signature. mwah. ππ
π¦ 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