2.19. InterruptDisable()

Purpose

A convenient function for shutting down interrupt handling.

Prototype
DWORD InterruptDisable(HANDLE hThread);
Parameters
NameTypeInput/Output
hThreadHANDLEInput
Description
NameDescription
hThread Interrupt thread handle, as received from InterruptEnable() [2.18] (*phThread)
Return Value

Returns WD_STATUS_SUCCESS (0) on success, or an appropriate error code otherwise [A].

Remarks
  • You can view the implementation of this function in WinDriver/src/wdapi/windrvr_int_thread.c.
  • InterruptDisable() uses the low-level WD_IntDisable() function [3.5]. When using InterruptEnable() [2.18] to enable interrupts, instead of calling the low-level WD_IntEnable() [3.2], WD_IntWait() [3.3] and WD_IntCount() [3.4] functions separately, the interrupts should be disabled using InterruptDisable() and not WD_IntDisable()

Example
main()
{
    ....
    if (InterruptEnable(&thread_handle, hWD, &Intrp,
        interrupt_handler, pData))
    {
        printf("failed enabling interrupt\n");
    }
    else
    {
        printf("Press Enter to uninstall interrupt\n");
        fgets(line, sizeof(line), stdin);
        InterruptDisable(thread_handle); /* Calls WD_IntDisable() */
    }
    ....
}