SDL_DestroyAsyncIOQueue(3)

πŸ’– SDL_DestroyAsyncIOQueue(3) β€” SDL3 FUNCTIONS πŸ’–

okay bestie, gather round, because we're talking about SDL_DestroyAsyncIOQueue from the SDL3 function fam. this is the lil cleanup baddie that says bye-bye to an async I/O task queue you made earlier. she's not dramatic, but she is blocking, so pay attention. πŸŽ€


✨ NAME ✨

SDL_DestroyAsyncIOQueue β€” destroy a previously-created async I/O task queue. that's it, that's the job. she cleans up after the party. πŸ’…


🌸 SYNOPSIS 🌸

#include <SDL3/SDL_asyncio.h>

void SDL_DestroyAsyncIOQueue(SDL_AsyncIOQueue *queue);

πŸ¦‹ DESCRIPTION πŸ¦‹

okay so here's the tea, and it's important tea. 🍡

If there are still tasks pending for this queue, this call will block until those tasks are finished. not "maybe", not "eventually" β€” she waits. and once they're done, all those tasks will be deallocated. their results? lost to the app. gone. no cap, they are not coming back to you. 😭

Any pending reads from SDL_LoadFileAsync() that are still chilling in this queue will have their buffers deallocated by this function, and that's on purpose β€” it's to prevent a memory leak. so she's actually doing you a solid there, not just being messy. 🫢

Once this function is called, the queue is no longer valid and should not be used. not by you, not by anyone β€” including by other threads that might try to access it while destruction is blocking on pending tasks. it's giving "do not perceive me, i am gone." πŸ’€

⚠️ Do not destroy a queue that still has threads waiting on it through SDL_WaitAsyncIOResult(). that's the cursed move. instead, you can call SDL_SignalAsyncIOQueue() first to unblock those threads, and take measures (such as SDL_WaitThread()) to make sure they have finished their wait and won't wait on the queue again. do the steps, bestie, in that order. πŸ™ˆ

πŸŽ€ FUNCTION PARAMETERS πŸŽ€

  • queue β€” the task queue to destroy. yeet her, but respectfully. πŸ‘‘

πŸ’œ THREAD SAFETY πŸ’œ

It is safe to call this function from any thread, so long as no other thread is waiting on the queue with SDL_WaitAsyncIOResult. that's the one condition. the vibe check is: nobody waiting, everybody happy. ⭐


🌈 AVAILABILITY 🌈

This function is available since SDL 3.2.0. so if you're on anything older, she is simply not there yet. iykyk. ✨


and that's the whole page, bestie!! this absolute icon lives in the Simple Directmedia Layer manual, SDL 3.4.18 era, filed under SDL_DestroyAsyncIOQueue(3). go forth, destroy your queues responsibly, and don't leave any threads waiting on them. mwah. πŸ’–πŸŽ€πŸ¦‹πŸŒΈπŸ’…πŸ«ΆπŸ”₯πŸ‘‘β­πŸ’€πŸ™ˆπŸ“πŸ§šπŸ’œ

πŸ“¦ where this page comes from