Discussion:
Switch/Continue approach giving different thread id's
(too old to reply)
g***@yahoo.co.in
2008-05-27 11:57:16 UTC
Permalink
Hello Igor,

1.I am calling Switch() method from OnResponse() .
2.Then call goes to Continue() method .
3.In this Continue() method I am getting the thread ID using the
function GetCurrentThreadId().
4. The thread Id's (for a single html page ) that I get are not all
same. i.e for a single page I have multiple thread id's

By calling switch the continue() should be called on the main thread,
right !!
Then how is it that I am getting different thread id's

I want to identify what all request/response pair belongs to a page.
(Even when multiple IE windows are open) . So I was trying to identify
it by using the thread ID of the main thread.

Is there any other way to achieve ??

Your response is much awaited,
Thanks & Regards
Hitesh
Igor Tandetnik
2008-05-27 17:10:39 UTC
Permalink
Post by g***@yahoo.co.in
1.I am calling Switch() method from OnResponse() .
2.Then call goes to Continue() method .
3.In this Continue() method I am getting the thread ID using the
function GetCurrentThreadId().
4. The thread Id's (for a single html page ) that I get are not all
same. i.e for a single page I have multiple thread id's
By calling switch the continue() should be called on the main thread,
right !!
Then how is it that I am getting different thread id's
I've tested it, and I get the same thread ID every time.

Be aware that the real protocol itself may call Switch, and receive
Continue. It may not pass PD_FORCE_SWITCH flag, and Continue call
resulting from such a Switch call may not arrive on the main thread. You
need to distinguish between your Continue calls arriving in response to
your calling Switch, and all other ones. Probably the easiest way is to
put some distinctive value into PROTOCOLDATA::dwState, and check for it
in Continue. If Continue comes with the same value, it's yours; if not,
you need to forward it on to the real protocol but otherwise ignore it.
--
With best wishes,
Igor Tandetnik

With sufficient thrust, pigs fly just fine. However, this is not
necessarily a good idea. It is hard to be sure where they are going to
land, and it could be dangerous sitting under them as they fly
overhead. -- RFC 1925
g***@yahoo.co.in
2008-05-27 17:43:14 UTC
Permalink
Post by Igor Tandetnik
Post by g***@yahoo.co.in
1.I am calling Switch() method from OnResponse() .
2.Then call goes to Continue() method .
3.In this Continue() method I am getting the thread ID using the
function GetCurrentThreadId().
4. The thread Id's (for a single html page ) that I get are not all
same. i.e for a single page I have multiple thread id's
By calling switch the continue() should be called on the main thread,
right !!
Then how is it that I am getting different thread id's
I've tested it, and I get the same thread ID every time.
Be aware that the real protocol itself may call Switch, and receive
Continue. It may not pass PD_FORCE_SWITCH flag, and Continue call
resulting from such a Switch call may not arrive on the main thread. You
need to distinguish between your Continue calls arriving in response to
your calling Switch, and all other ones. Probably the easiest way is to
put some distinctive value into PROTOCOLDATA::dwState, and check for it
in Continue. If Continue comes with the same value, it's yours; if not,
you need to forward it on to the real protocol but otherwise ignore it.
--
With best wishes,
    Igor Tandetnik
With sufficient thrust, pigs fly just fine. However, this is not
necessarily a good idea. It is hard to be sure where they are going to
land, and it could be dangerous sitting under them as they fly
overhead. -- RFC 1925
Hello Igor,

Thank you so much ---- You have given such a brilliant solution for
identifying who is calling the Continue() method.

Thanks again for your guidance.

With Best Regards
Hitesh

Loading...