If you still want to Suspend the thread another option may
be to call ThreadDetach before Suspend and ThreadAttach
when the thread is resumed again.
Something like this:
Create it;
WSocket1.ThreadDetach;
while not Terminated do
begin
WSocket1.ThreadAttach;
WSocket1.Send(Something);
WSocket1.MessageLoop;
PostMessage(ParentFormHwnd, WM_Thread_Suspended, Integer(Self), 0);
WSocket1.ThreadDetach;
Suspend;
end;
Arno Garrels
Wilfried Mestdagh wrote:
> Hello,
>
> In additions to the reply of Francois: In the rare occasions that I have
> a hidden window in a thread that has to be reused whole the time, I dont
> go into suspended but just do nothing. The messagepump I uses, uses
> GetMessage(), so if no message is post then GetMessage is in a wait
> state with almost no CPU load.
>
> ---
> Rgds, Wilfried [TeamICS]
> http://www.overbyte.be/eng/overbyte/teamics.html
> http://www.mestdagh.biz
>
> Friday, February 17, 2006, 21:58, asvetov wrote:
>
>> Hello, Wilfried!
>
>> Thank you for clarifying this. Do you have any recommendations how
>> to avoid this behaviour? I think many people works with different ICS
>> components in threads and reuse threads (doing suspend/resume) and all
>> they have this problem? Or I│ am the only one who haven│t solved this
>> :)
>
>> Best regards, A. Svetov
>
>>> Hello asvetov,
>>>
>>> This is normal behaviour in windows. If you create a (hidden) window in
>>> a thread you must pump messages or your system can deadlock. If you
>>> suspend a thread having a window then it cannot pump, so that is what
>>> you experiance.
>>>
>>> ---
>>> Rgds, Wilfried [TeamICS]
>>> http://www.overbyte.be/eng/overbyte/teamics.html
>>> http://www.mestdagh.biz
--
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