SDL_AsyncIOOutcome(3type)

πŸ’– SDL_AsyncIOOutcome πŸ’–

okay bestie, welcome to SDL_AsyncIOOutcome β€” it's a datatype from the SDL3 family (the whole SDL3 DATATYPES squad, iykyk) and it's literally just the lil receipt you get back when an asynchronous I/O request finishes. no cap. πŸ’…


✨ NAME ✨

SDL_AsyncIOOutcome β€” all the info about an asynchronous I/O request that's already done and dusted. πŸŽ€


πŸ¦‹ SYNOPSIS πŸ¦‹

#include <SDL3/SDL_asyncio.h>

typedef struct SDL_AsyncIOOutcome
{
    SDL_AsyncIO *asyncio;   /**< what generated this task. This pointer will be invalid if it was closed! */
    SDL_AsyncIOTaskType type;  /**< What sort of task was this? Read, write, etc? */
    SDL_AsyncIOResult result;  /**< the result of the work (success, failure, cancellation). */
    void *buffer;  /**< buffer where data was read/written. */
    Uint64 offset;  /**< offset in the SDL_AsyncIO where data was read/written. */
    Uint64 bytes_requested;  /**< number of bytes the task was to read/write. */
    Uint64 bytes_transferred;  /**< actual number of bytes that were read/written. */
    void *userdata;    /**< pointer provided by the app when starting the task */
} SDL_AsyncIOOutcome;

🌸 DESCRIPTION 🌸

so like, when you kick off an async I/O task and it finally comes back to you, this struct is the whole story. it's giving "here's everything that went down while you were waiting." let's go field by field, bestie, because every single one matters. 🫢

  • SDL_AsyncIO *asyncio β€” the thing that generated this task. but bestie, listen: this pointer will be invalid if it was closed! 😭 so don't go dereferencing it after you closed the handle, fr fr.
  • SDL_AsyncIOTaskType type β€” what sort of task was this even? read? write? etc? vibe check on the task type. πŸ”₯
  • SDL_AsyncIOResult result β€” the result of the work. could be success, failure, or cancellation. that's the tea. πŸ’€
  • void *buffer β€” the buffer where the data was read into or written from. the actual hangout spot for your bytes. πŸ“
  • Uint64 offset β€” the offset in the SDL_AsyncIO where the data was read/written. where in the file we were, basically. ⭐
  • Uint64 bytes_requested β€” how many bytes the task was supposed to read/write. the plan. ✨
  • Uint64 bytes_transferred β€” the actual number of bytes that got read/written. the reality. and yeah, plan β‰  reality sometimes, that's why both exist. πŸ™ˆ
  • void *userdata β€” the pointer you (the app) handed over when starting the task. your lil note-to-self, returned safely. πŸŽ€

🌈 AVAILABILITY 🌈

this struct has been around since SDL 3.2.0. iconic behavior honestly. πŸ‘‘


heads up bestie: that asyncio pointer being invalid after close is NOT a drill. if you closed it, it's gone gone. 🫢

that's the whole page, no notes. mwah. πŸ’…βœ¨

Simple Directmedia Layer, SDL 3.4.18 β€” shoutout to the SDL3 DATATYPES era, this page was served fresh and cute, tysm for reading, ily, bye bestie!! πŸ¦‹πŸ’–πŸŒΈ

πŸ“¦ where this page comes from