mirror of
https://github.com/libsdl-org/SDL.git
synced 2026-05-30 13:28:13 +08:00
Renamed SDL_ASYNCIO_CANCELLED to SDL_ASYNCIO_CANCELED
This commit is contained in:
@@ -144,7 +144,7 @@ typedef enum SDL_AsyncIOResult
|
|||||||
{
|
{
|
||||||
SDL_ASYNCIO_COMPLETE, /**< request was completed without error */
|
SDL_ASYNCIO_COMPLETE, /**< request was completed without error */
|
||||||
SDL_ASYNCIO_FAILURE, /**< request failed for some reason; check SDL_GetError()! */
|
SDL_ASYNCIO_FAILURE, /**< request failed for some reason; check SDL_GetError()! */
|
||||||
SDL_ASYNCIO_CANCELLED /**< request was cancelled before completing. */
|
SDL_ASYNCIO_CANCELED /**< request was canceled before completing. */
|
||||||
} SDL_AsyncIOResult;
|
} SDL_AsyncIOResult;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -64,7 +64,7 @@ static void AsyncIOTaskComplete(SDL_AsyncIOTask *task)
|
|||||||
// This is called directly, without a threadpool, if !SDL_ASYNCIO_USE_THREADPOOL.
|
// This is called directly, without a threadpool, if !SDL_ASYNCIO_USE_THREADPOOL.
|
||||||
static void SynchronousIO(SDL_AsyncIOTask *task)
|
static void SynchronousIO(SDL_AsyncIOTask *task)
|
||||||
{
|
{
|
||||||
SDL_assert(task->result != SDL_ASYNCIO_CANCELLED); // shouldn't have gotten in here if cancelled!
|
SDL_assert(task->result != SDL_ASYNCIO_CANCELED); // shouldn't have gotten in here if canceled!
|
||||||
|
|
||||||
GenericAsyncIOData *data = (GenericAsyncIOData *) task->asyncio->userdata;
|
GenericAsyncIOData *data = (GenericAsyncIOData *) task->asyncio->userdata;
|
||||||
SDL_IOStream *io = data->io;
|
SDL_IOStream *io = data->io;
|
||||||
@@ -184,7 +184,7 @@ static void QueueAsyncIOTask(SDL_AsyncIOTask *task)
|
|||||||
SDL_LockMutex(threadpool_lock);
|
SDL_LockMutex(threadpool_lock);
|
||||||
|
|
||||||
if (stop_threadpool) { // just in case.
|
if (stop_threadpool) { // just in case.
|
||||||
task->result = SDL_ASYNCIO_CANCELLED;
|
task->result = SDL_ASYNCIO_CANCELED;
|
||||||
AsyncIOTaskComplete(task);
|
AsyncIOTaskComplete(task);
|
||||||
} else {
|
} else {
|
||||||
LINKED_LIST_PREPEND(task, threadpool_tasks, threadpool);
|
LINKED_LIST_PREPEND(task, threadpool_tasks, threadpool);
|
||||||
@@ -239,7 +239,7 @@ static void ShutdownThreadpool(void)
|
|||||||
SDL_AsyncIOTask *task;
|
SDL_AsyncIOTask *task;
|
||||||
while ((task = LINKED_LIST_START(threadpool_tasks, threadpool)) != NULL) {
|
while ((task = LINKED_LIST_START(threadpool_tasks, threadpool)) != NULL) {
|
||||||
LINKED_LIST_UNLINK(task, threadpool);
|
LINKED_LIST_UNLINK(task, threadpool);
|
||||||
task->result = SDL_ASYNCIO_CANCELLED;
|
task->result = SDL_ASYNCIO_CANCELED;
|
||||||
AsyncIOTaskComplete(task);
|
AsyncIOTaskComplete(task);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -300,14 +300,14 @@ static bool generic_asyncioqueue_queue_task(void *userdata, SDL_AsyncIOTask *tas
|
|||||||
static void generic_asyncioqueue_cancel_task(void *userdata, SDL_AsyncIOTask *task)
|
static void generic_asyncioqueue_cancel_task(void *userdata, SDL_AsyncIOTask *task)
|
||||||
{
|
{
|
||||||
#if !SDL_ASYNCIO_USE_THREADPOOL // in theory, this was all synchronous and should never call this, but just in case.
|
#if !SDL_ASYNCIO_USE_THREADPOOL // in theory, this was all synchronous and should never call this, but just in case.
|
||||||
task->result = SDL_ASYNCIO_CANCELLED;
|
task->result = SDL_ASYNCIO_CANCELED;
|
||||||
AsyncIOTaskComplete(task);
|
AsyncIOTaskComplete(task);
|
||||||
#else
|
#else
|
||||||
// we can't stop i/o that's in-flight, but we _can_ just refuse to start it if the threadpool hadn't picked it up yet.
|
// we can't stop i/o that's in-flight, but we _can_ just refuse to start it if the threadpool hadn't picked it up yet.
|
||||||
SDL_LockMutex(threadpool_lock);
|
SDL_LockMutex(threadpool_lock);
|
||||||
if (LINKED_LIST_PREV(task, threadpool) != NULL) { // still in the queue waiting to be run? Take it out.
|
if (LINKED_LIST_PREV(task, threadpool) != NULL) { // still in the queue waiting to be run? Take it out.
|
||||||
LINKED_LIST_UNLINK(task, threadpool);
|
LINKED_LIST_UNLINK(task, threadpool);
|
||||||
task->result = SDL_ASYNCIO_CANCELLED;
|
task->result = SDL_ASYNCIO_CANCELED;
|
||||||
AsyncIOTaskComplete(task);
|
AsyncIOTaskComplete(task);
|
||||||
}
|
}
|
||||||
SDL_UnlockMutex(threadpool_lock);
|
SDL_UnlockMutex(threadpool_lock);
|
||||||
|
|||||||
@@ -225,7 +225,7 @@ static SDL_AsyncIOTask *ProcessCQE(LibUringAsyncIOQueueData *queuedata, struct i
|
|||||||
task = (SDL_AsyncIOTask *) cancel_task->app_userdata;
|
task = (SDL_AsyncIOTask *) cancel_task->app_userdata;
|
||||||
SDL_free(cancel_task);
|
SDL_free(cancel_task);
|
||||||
if (cqe->res >= 0) { // cancel was successful?
|
if (cqe->res >= 0) { // cancel was successful?
|
||||||
task->result = SDL_ASYNCIO_CANCELLED;
|
task->result = SDL_ASYNCIO_CANCELED;
|
||||||
} else {
|
} else {
|
||||||
task = NULL; // it already finished or was too far along to cancel, so we'll pick up the actual results later.
|
task = NULL; // it already finished or was too far along to cancel, so we'll pick up the actual results later.
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -195,7 +195,7 @@ static SDL_AsyncIOTask *ProcessCQE(WinIoRingAsyncIOQueueData *queuedata, IORING_
|
|||||||
task = (SDL_AsyncIOTask *) cancel_task->app_userdata;
|
task = (SDL_AsyncIOTask *) cancel_task->app_userdata;
|
||||||
SDL_free(cancel_task);
|
SDL_free(cancel_task);
|
||||||
if (SUCCEEDED(cqe->ResultCode)) { // cancel was successful?
|
if (SUCCEEDED(cqe->ResultCode)) { // cancel was successful?
|
||||||
task->result = SDL_ASYNCIO_CANCELLED;
|
task->result = SDL_ASYNCIO_CANCELED;
|
||||||
} else {
|
} else {
|
||||||
task = NULL; // it already finished or was too far along to cancel, so we'll pick up the actual results later.
|
task = NULL; // it already finished or was too far along to cancel, so we'll pick up the actual results later.
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -139,7 +139,7 @@ static void async_io_task_complete(const SDL_AsyncIOOutcome *outcome)
|
|||||||
#define RESCASE(x) case x: resultstr = #x; break
|
#define RESCASE(x) case x: resultstr = #x; break
|
||||||
RESCASE(SDL_ASYNCIO_COMPLETE);
|
RESCASE(SDL_ASYNCIO_COMPLETE);
|
||||||
RESCASE(SDL_ASYNCIO_FAILURE);
|
RESCASE(SDL_ASYNCIO_FAILURE);
|
||||||
RESCASE(SDL_ASYNCIO_CANCELLED);
|
RESCASE(SDL_ASYNCIO_CANCELED);
|
||||||
#undef RESCASE
|
#undef RESCASE
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user