From: Kursat on
Hi,

I am using timer queue timers as timeout provider for overlapped Winsock
operations. I use CreateTimerQueueTimer and DeleteTimerQueueTimer with
default timer queue. CreateTimerQueueTimer failed with ERROR_INVALID_HANDLE
once. I could not reproduce the error but it happened for sure. There is no
information about the failure on the web. My question is; in which
circumstances this function fails with ERROR_INVALID_HANDLE?

Thanks in advance


From: Alexandre Grigoriev on

When a handle argument is incorrect. The only handle argument in that
function is TimerQueue, which is optional. If it's not NULL or a valid timer
queue handle, you'll get ERROR_INVALID_HANDLE.

"Kursat" <xx(a)yy.com> wrote in message
news:#nUcasV5KHA.5952(a)TK2MSFTNGP04.phx.gbl...
> Hi,
>
> I am using timer queue timers as timeout provider for overlapped Winsock
> operations. I use CreateTimerQueueTimer and DeleteTimerQueueTimer with
> default timer queue. CreateTimerQueueTimer failed with
> ERROR_INVALID_HANDLE once. I could not reproduce the error but it happened
> for sure. There is no information about the failure on the web. My
> question is; in which circumstances this function fails with
> ERROR_INVALID_HANDLE?
>
> Thanks in advance
>
From: Kursat on


"Alexandre Grigoriev" wrote:

> When a handle argument is incorrect. The only handle argument in that
> function is TimerQueue, which is optional. If it's not NULL or a valid timer
> queue handle, you'll get ERROR_INVALID_HANDLE.
>
> "Kursat" <xx(a)yy.com> wrote in message
> news:#nUcasV5KHA.5952(a)TK2MSFTNGP04.phx.gbl...
> > Hi,
> >
> > I am using timer queue timers as timeout provider for overlapped Winsock
> > operations. I use CreateTimerQueueTimer and DeleteTimerQueueTimer with
> > default timer queue. CreateTimerQueueTimer failed with
> > ERROR_INVALID_HANDLE once. I could not reproduce the error but it happened
> > for sure. There is no information about the failure on the web. My
> > question is; in which circumstances this function fails with
> > ERROR_INVALID_HANDLE?
> >
> > Thanks in advance
> >
> .
>

As said in the original post, I use default timer queue which means that I
pass NULL as TimerQueue handle. It is very strange failure, no handle passed
but it complains of invalid handle.
From: Hector Santos on
Kursat,

Probably a small snippet of code showing basically how you are doing
this because I can't duplicate it. However, my quick test has no
association with sockets, which to me, is pretty odd as to why and
when to employ this logic. I never can across a need to do something
like this with overlapping socket I/O. Are you trying to program some
sort of socket I/O timeout?

I'm winging it but it sounds like you are "pulling the rug from within
threads feet" prematurely or out of sync and an invalid handle is
created. If all you are seeking here is to create an asynchronous
socket I/O timeout design, then why not simply use select().

--
HLS


Kursat wrote:

>
> "Alexandre Grigoriev" wrote:
>
>> When a handle argument is incorrect. The only handle argument in that
>> function is TimerQueue, which is optional. If it's not NULL or a valid timer
>> queue handle, you'll get ERROR_INVALID_HANDLE.
>>
>> "Kursat" <xx(a)yy.com> wrote in message
>> news:#nUcasV5KHA.5952(a)TK2MSFTNGP04.phx.gbl...
>>> Hi,
>>>
>>> I am using timer queue timers as timeout provider for overlapped Winsock
>>> operations. I use CreateTimerQueueTimer and DeleteTimerQueueTimer with
>>> default timer queue. CreateTimerQueueTimer failed with
>>> ERROR_INVALID_HANDLE once. I could not reproduce the error but it happened
>>> for sure. There is no information about the failure on the web. My
>>> question is; in which circumstances this function fails with
>>> ERROR_INVALID_HANDLE?
>>>
>>> Thanks in advance
>
> As said in the original post, I use default timer queue which means that I
> pass NULL as TimerQueue handle. It is very strange failure, no handle passed
> but it complains of invalid handle.

From: Kursat on

"Hector Santos" <sant9442(a)nospam.gmail.com> wrote in message
news:OuUqk3f5KHA.5476(a)TK2MSFTNGP06.phx.gbl...
> Kursat,
>
> Probably a small snippet of code showing basically how you are doing this
> because I can't duplicate it. However, my quick test has no association
> with sockets, which to me, is pretty odd as to why and when to employ this
> logic. I never can across a need to do something like this with
> overlapping socket I/O. Are you trying to program some sort of socket I/O
> timeout?
>
> I'm winging it but it sounds like you are "pulling the rug from within
> threads feet" prematurely or out of sync and an invalid handle is created.
> If all you are seeking here is to create an asynchronous socket I/O
> timeout design, then why not simply use select().
>
> --
> HLS

Hi Hector,

Yes, I use timer queue timers for socket IO timeout. I can not figure out
why overlapped socket operations don't have any timeout mechanism by
themselves but this is another story. I don't use select() because I am
using IO completion ports.