Discussion:
DeleteTimerQueueTimer, strange behavior
(too old to reply)
Kursat
2010-06-11 10:51:02 UTC
Permalink
Hi,

I call DeleteTimerQueueTimer function in timer callback function. My first
question is "is that safe?"

Assuming that there is no problem, I pass NULL for CompletionEvent parameter
so that the function does not block. So far so good, but because I call
DeleteTimerQueueTimer function in timer callback function it should return
FALSE and GetLastError () should return ERROR_IO_PENDING stating that the
callback function is running. This happens most of the times but sometimes
the function returns TRUE as if the timer callback function has completed.
This behavior is strange because I call DeleteTimerQueueTimer inside timer
callback function. Do you have any idea about what goes wrong?

Thanks in advance
Leo Davidson
2010-06-11 14:01:05 UTC
Permalink
Post by Kursat
I pass NULL for CompletionEvent parameter
so that the function does not block.
I don't know if it's relevant to what you are seeing but you're
supposed to pass INVALID_HANDLE_VALUE for the CompletionEvent if you
don't want it to block. ( http://msdn.microsoft.com/en-us/library/ms682569%28VS.85%29.aspx
)

Unfortunately, INVALID_HANDLE_VALUE and NULL are not the same. It's
something to be careful of because some functions use one while others
use the other for their handles/results.

Loading...