mirror of
https://gitea.tendokyu.moe/Dniel97/segatools.git
synced 2024-11-30 15:54:27 +01:00
util/async.c: Small locking fix
This commit is contained in:
parent
657367c040
commit
2df92f7492
@ -60,6 +60,8 @@ HRESULT async_submit(struct async *async, struct irp *irp, async_task_t task)
|
|||||||
return task(async->ctx, irp);
|
return task(async->ctx, irp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
EnterCriticalSection(&async->lock);
|
||||||
|
|
||||||
if (async->thread == NULL) {
|
if (async->thread == NULL) {
|
||||||
/* Ensure our worker thread is running */
|
/* Ensure our worker thread is running */
|
||||||
async->thread = (HANDLE) _beginthreadex(
|
async->thread = (HANDLE) _beginthreadex(
|
||||||
@ -75,8 +77,6 @@ HRESULT async_submit(struct async *async, struct irp *irp, async_task_t task)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
EnterCriticalSection(&async->lock);
|
|
||||||
|
|
||||||
while (async->task != NULL) {
|
while (async->task != NULL) {
|
||||||
ok = SleepConditionVariableCS(&async->avail, &async->lock, INFINITE);
|
ok = SleepConditionVariableCS(&async->avail, &async->lock, INFINITE);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user