Skip to content

Commit

Permalink
Io: Don't allow async close while async busy.
Browse files Browse the repository at this point in the history
  • Loading branch information
unknownbrackets committed Jan 24, 2021
1 parent a88f6b4 commit c7bf68c
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions Core/HLE/sceIo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2017,20 +2017,22 @@ static int sceIoChangeAsyncPriority(int id, int priority) {
return hleLogSuccessI(SCEIO, 0);
}

static int sceIoCloseAsync(int id)
{
static int sceIoCloseAsync(int id) {
u32 error;
FileNode *f = __IoGetFd(id, error);
if (f) {
f->closePending = true;

auto &params = asyncParams[id];
params.op = IoAsyncOp::CLOSE;
IoStartAsyncThread(id, f);
return hleLogSuccessI(SCEIO, 0);
} else {
if (!f) {
return hleLogError(SCEIO, error, "bad file descriptor");
}
if (f->asyncBusy()) {
return hleLogWarning(SCEIO, SCE_KERNEL_ERROR_ASYNC_BUSY, "async busy");
}

f->closePending = true;

auto &params = asyncParams[id];
params.op = IoAsyncOp::CLOSE;
IoStartAsyncThread(id, f);
return hleLogSuccessI(SCEIO, 0);
}

static u32 sceIoSetAsyncCallback(int id, u32 clbckId, u32 clbckArg)
Expand Down

0 comments on commit c7bf68c

Please sign in to comment.