----- Original Message ----- 
From: "Arno Garrels" <[EMAIL PROTECTED]>
To: "ICS support mailing" <twsocket@elists.org>
Sent: Wednesday, August 22, 2007 11:16 AM
Subject: Re: [twsocket] ThreadDEtach with THttpConnection problem

> Francois Piette wrote:
>>> In triggersessionclosed, I postthreadmessage to a message handler in
>>> the same worker thread which then thread-detaches and posts the
>>> object to listener thread. However, in every 1-2 hours, under heavy
>>> load, the worker thread gives an AV which I suspect is due to a
>>> recv/send callback event being launched after threaddetach. How can
>>> I prevent this?
>> If you had looked at the source code, you could have seen that when
>> ThreadDetach is called, the socket is asked to stop sending
>> notifications (WSAASyncSelect is called with nul mask) and the hidden
>> window is cancelled. So technically speaking, no notification can
>> take place before you attach the socket again to a thread in which
>> case a new hidden window is assigned and WSAASyncSelect called to
>> request notifications from winsock.
>> In ICS-V6, the hidden window is shared by several components.
>> ThreadDetach unregister the messages which where used by the
>> component.
> Even if there were still such unregistered messages pending in the message
> queue due to the hidden window still exists (handling messages for other
> components of that thread) those unregistered messages won't be touched
> by the component but handled by DefWindowProc, so no problem. If the
> hidden window has been destroyed Windows flushes the thread message
> queue so GetMessage() should never see a message for a non-existing
> window.

How does DefWindowProc work? What if the handle posted is no longer in that 
thread? I think we are getting a clue here... Sharing the same window handle 
in V6 could be the reason for my AV.



To unsubscribe or change your settings for TWSocket mailing list
please goto http://www.elists.org/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be

Reply via email to