25 lines
759 B
C
25 lines
759 B
C
// Kernel passive-level work queue declarations.
|
|
|
|
#pragma once
|
|
#include <stdbool.h>
|
|
#include <kernel/ke_list.h>
|
|
#include <ntlite/status.h>
|
|
|
|
// Work items are caller-owned embedded objects. They may be queued from
|
|
// interrupt/DPC/spinlock context and run later on a persistent system worker
|
|
// thread at PASSIVE_LEVEL. Queueing the same item while it is already queued
|
|
// is coalesced.
|
|
typedef void (*KWORK_ROUTINE)(void* context);
|
|
|
|
typedef struct KWORK_ITEM {
|
|
LIST_ENTRY Link;
|
|
KWORK_ROUTINE Routine;
|
|
void* Context;
|
|
volatile long Queued;
|
|
} KWORK_ITEM;
|
|
|
|
void KeInitializeWorkItem(KWORK_ITEM* item, KWORK_ROUTINE routine, void* context);
|
|
KSTATUS KeStartWorkQueue(void);
|
|
bool KeIsWorkQueueStarted(void);
|
|
bool KeQueueWorkItem(KWORK_ITEM* item);
|