0
Queue_delayed_work is a non blocking "timer" function which will queue `dwork` after `delay` jiffies.

我找不到任何相同的非阻塞函数 WIN API。

知道是否有某些功能,我不知道。或者如何实现这样的事情(一个非阻塞的“计时器”,它至少dwork会在几秒钟workq后排队。 delay

4

1 回答 1

0

对于 Linux 用户空间,只有 teo 系统调用允许设置计时器,而不会同时阻塞事件的调用进程:

-timer_set_time
-Alarm

对于 Win 内核,

可以用 KTIMER 实现

KTIMER (Wdm.h)
KeInitializeTimer(PKTIMER Timer):
Timer: Pointer to a timer object, for which the caller provides the storage.
KeSetTimer (PKTIMER Timer, LARGE_INTEGER DueTimer, **PKDPC Dpc**)

对于 Win 用户空间,

可以用等待定时器对象实现:

BOOL SetWaitableTimer(
HANDLE hTimer, // handle to a timer object
const LARGE_INTEGER *pDueTime, // when timer will become signaled
LONG lPeriod, // periodic timer interval
PTIMERAPCROUTINE pfnCompletionRoutine, // pointer to the completion routine
LPVOID lpArgToCompletionRoutine, // data passed to the completion routine
BOOL fResume // flag for resume state    
);
于 2012-04-30T17:36:19.053 回答