1
0
mirror of https://gitea.tendokyu.moe/Hay1tsme/segatools.git synced 2024-11-14 21:47:38 +01:00
segatools-hay1tsme/util/async.h

25 lines
509 B
C
Raw Normal View History

#pragma once
#include <windows.h>
#include <stdbool.h>
#include "hook/iohook.h"
typedef HRESULT (*async_task_t)(void *ctx, struct irp *irp);
struct async {
CRITICAL_SECTION lock;
CONDITION_VARIABLE pend;
CONDITION_VARIABLE avail;
HANDLE thread;
struct irp irp;
async_task_t task;
void *ctx;
bool stop;
};
void async_init(struct async *async, void *ctx);
void async_fini(struct async *async);
HRESULT async_submit(struct async *async, struct irp *irp, async_task_t task);