SDL_GetAsyncIOResult(3)

πŸ’– SDL_GetAsyncIOResult(3) πŸ’–

okay bestie so this is a page from the SDL3 FUNCTIONS manual, and today's main character is SDL_GetAsyncIOResult πŸ¦‹


✨ NAME ✨

SDL_GetAsyncIOResult β€” like, go ask your async I/O task queue if anything finished yet πŸ‘€


🌸 SYNOPSIS 🌸

#include <SDL3/SDL_asyncio.h>

bool SDL_GetAsyncIOResult(SDL_AsyncIOQueue *queue, SDL_AsyncIOOutcome *outcome);

πŸ’… DESCRIPTION πŸ’…

So here's the vibe: if a task assigned to this queue has finished, this function returns true and fills in outcome with all the deets of that task. If literally nothing in the queue has finished, it returns false. And it does not block β€” it's giving "I'm just checking, no pressure, no waiting around" πŸ’–

If a task has completed, this function will free its resources and the task pointer will no longer be valid, bestie. Like, gone. Also, the task gets removed from the queue. So don't go holding onto that pointer afterwards, fr fr 😭

And the slayest part: it is safe for multiple threads to call this function on the same queue at once. A completed task will only go to one of the threads β€” no double-dipping, no drama, no chaos πŸ‘‘


πŸŽ€ FUNCTION PARAMETERS πŸŽ€

  • queue β€” the async I/O task queue you're querying, like knocking on the door and being like "anyone done in there?" πŸšͺ
  • outcome β€” the details of a finished task get written here. It may not be NULL, so don't even try it πŸ™ˆ

⭐ RETURN VALUE ⭐

Returns true if a task has completed, and false otherwise. Simple. Iconic. Periodt. πŸ’…


🌈 THREAD SAFETY 🌈

It is safe to call this function from any thread. Every single one. Go off. 🧚


πŸ¦‹ AVAILABILITY πŸ¦‹

This function has been available since SDL 3.2.0. Old enough to be trusted, young enough to be cute ✨


πŸ‘‘ SEE ALSO πŸ‘‘


ngl, the "may not be NULL" on outcome is not a suggestion, bestie. That's a whole warning. Respect it 🫢

kisses, this was the Simple Directmedia Layer era of the docs, SDL 3.4.18 energy, and SDL_GetAsyncIOResult(3) said what it said πŸ’–βœ¨πŸŽ€

πŸ“¦ where this page comes from