Function SDL_WaitAsyncIOResult
pub unsafe extern "C" fn SDL_WaitAsyncIOResult(
queue: *mut SDL_AsyncIOQueue,
outcome: *mut SDL_AsyncIOOutcome,
timeoutMS: i32,
) -> bool
dep_sdl3
only.Expand description
Block until an async I/O task queue has a completed task.
This function puts the calling thread to sleep until there a task assigned to the queue that has finished.
If a task assigned to the queue has finished, this will return true and
fill in outcome
with the details of the task. If no task in the queue has
finished, this function will return false.
If a task has completed, this function will free its resources and the task pointer will no longer be valid. The task will be removed from the queue.
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.
Note that by the nature of various platforms, more than one waiting thread
may wake to handle a single task, but only one will obtain it, so
timeoutMS
is a maximum wait time, and this function may return false
sooner.
This function may return false if there was a system error, the OS
inadvertently awoke multiple threads, or if SDL_SignalAsyncIOQueue()
was
called to wake up all waiting threads without a finished task.
A timeout can be used to specify a maximum wait time, but rather than
polling, it is possible to have a timeout of -1 to wait forever, and use
SDL_SignalAsyncIOQueue()
to wake up the waiting threads later.
§Parameters
queue
: the async I/O task queue to wait on.outcome
: details of a finished task will be written here. May not be NULL.timeoutMS
: the maximum time to wait, in milliseconds, or -1 to wait indefinitely.
§Return value
Returns true if task has completed, false otherwise.
§Thread safety
It is safe to call this function from any thread.
§Availability
This function is available since SDL 3.2.0.