1
0
mirror of https://gitea.tendokyu.moe/Dniel97/segatools.git synced 2024-11-24 05:20:10 +01:00
segatools-dniel97/util/async.h
Tau ba8b8e32fc util/async.c: Add async IO worker thread
Need this for IO4 USB emulation, might break it out and upstream it
to Capnhook at some point as well.
2019-03-04 16:47:32 -05:00

25 lines
509 B
C

#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);