内核模式代码可以prevent some or all asynchronous procedure calls (APCs) by entering a critical or guarded region or by Raising the current IRQL。这样,可以执行包含警报警报的代码,而不会受到APC的干扰。
用户模式代码是否有类似的方式(暂时)禁用当前线程中的用户模式APC?
我很高兴为托管和非托管代码提供答案。我已经验证了以下方法不能正常工作:
EnterCriticalSection
/ LeaveCriticalSection
)std::mutex
,std::recursive_mutex
,...)lock
条语句,MethodImpl(MethodImplOptions.Synchronized)
注释)