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 throughSDL_WaitAsyncIOResult(). that's the cursed move. instead, you can callSDL_SignalAsyncIOQueue()first to unblock those threads, and take measures (such asSDL_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
- 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