DeleteTimerQueueTimer Possible FALSE return conditions

Russell Kaplan 1 Reputation point
2021-03-05T21:09:46.567+00:00

DeleteTimerQueueTimer is documented as returning FALSE with GetLastError value ERROR_IO_PENDING when the callback is queued to run or is running (when using NULL as the notification completion handle). The documentation indicates that if the routine returns FALSE with a different GetLastError value, it should be retried. However, the documentation does not really provide any reasons why a different GetLastError would be returned, or why a retry (how many?) would stand any better chance of success. The questions then are assuming a valid timer queue handle, and timer handle, and NULL as the completion notification what are the other possible GetLastError return values, other than ERROR_IO_PENDING. If a GetLastError returns FALSE with a GetLastError being something other than ERROR_IO_PENDING, and the call is not retried, is there a possibility then that the timer callback will actually fire in the future, assuming it hasn't fired yet (or is not queued to fire).

Windows API - Win32
Windows API - Win32
A core set of Windows application programming interfaces (APIs) for desktop and server applications. Previously known as Win32 API.
2,419 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Song Zhu - MSFT 906 Reputation points
    2021-03-08T06:29:32.53+00:00

    When calling Win32 Api, the error and the reason are written in System Error Codes. You can use the error code to determine the cause of the error when you encounter an error.

    The reason for the additional label ERROR_IO_PENDING is that when the error is returned, it does not mean that the function call failed. It is that the current timer queue is busy and cannot be processed immediately. However, it has been successfully submitted and will be processed when the subsequent timer queue is free.

    Other possible errors were not submitted successfully. So they were not successfully deleted from the timer queue, and the timer will not be deleted in the future, so it is recommended that you try to call the function again.


    If the answer is helpful, please click "Accept Answer" and upvote it.

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments