Frans van Daalen wrote:
> and if you replace waitfor it with a ThreadTerminated construction,
> maybe thats easier? I used waitfor only once and had deadlock issues
> which caused me to removed asap :-)

Not sure what you mean. The problem is that even if you call ThreadDetach
(which is to make the component windowless) you cannot be sure that the
component will not allocate another window handle somewhere in the background
after that call to ThreadDetach.


> 
> ----- Original Message -----
> From: "Arno Garrels" <[EMAIL PROTECTED]>
> To: "ICS support mailing" <twsocket@elists.org>
> Sent: Thursday, June 22, 2006 8:01 PM
> Subject: Re: [twsocket] V6 ThreadDetach #2
> 
> 
>> Francois PIETTE wrote:
>>> This is surely not the problem, but WaitFor should be avoided when
>>> possible. It is known to create deadlocks.
>> 
>> I already exchanged it by a simple WaitForSingleObject(ThreadHandle)
>> since WaitFor is know to make trouble, anyway the problem persists.
>> 
>> 
>>> --
>>> Contribute to the SSL Effort. Visit
>>> http://www.overbyte.be/eng/ssl.html --
>>> [EMAIL PROTECTED]
>>> http://www.overbyte.be
>>> 
>>> 
>>> ----- Original Message -----
>>> From: "Arno Garrels" <[EMAIL PROTECTED]>
>>> To: "ICS support mailing" <twsocket@elists.org>
>>> Sent: Thursday, June 22, 2006 6:59 PM
>>> Subject: Re: [twsocket] V6 ThreadDetach #2
>>> 
>>> 
>>>> Fastream Technologies wrote:
>>>>> I had the same problem. In my case, I had to post a message before
>>>>> ending the thread. There was pending messages that called
>>>>> GetHandle which called AllocateHwnd()!!!
>>>> 
>>>> My problem still persists, sometimes the exception "Cannot attach
>>>> when not detached" is raised. However I cannot imagine that
>>>> exchanging WaitFor by your method can change anything basically.
>>>> Probably the strange GetHandle() getter is the culprid?
>>>> 
>>>> 
>>>>> 
>>>>> Regards,
>>>>> 
>>>>> SZ
>>>>> 
>>>>> ----- Original Message -----
>>>>> From: "Arno Garrels" <[EMAIL PROTECTED]>
>>>>> To: "ICS support mailing" <twsocket@elists.org>
>>>>> Sent: Thursday, June 22, 2006 4:20 PM
>>>>> Subject: [twsocket] V6 ThreadDetach #2
>>>>> 
>>>>> 
>>>>>> I have the following problem in V6:
>>>>>> 
>>>>>> constructor TListenThread.Create(AServer: TMtWSocketServer);
>>>>>> begin
>>>>>>    inherited Create(True);
>>>>>>    FreeOnTerminate := FALSE;
>>>>>>    FServer         := AServer;
>>>>>>    FServer.ThreadDetach;
>>>>>> end;
>>>>>> 
>>>>>> procedure TListenThread.Execute;
>>>>>> begin
>>>>>>    FServer.ThreadAttach;
>>>>>>    FServer.Listen;
>>>>>>    FServer.MessageLoop;
>>>>>>    FServer.Close;
>>>>>>    FServer.ThreadDetach;
>>>>>> end;
>>>>>> 
>>>>>> procedure TForm1.btnStartClick(Sender: TObject);
>>>>>> begin
>>>>>>    //properties of Server1 are assigned
>>>>>>    FListenThread := TListenThread.Create(Server1);
>>>>>>    FListenThread.Resume;
>>>>>> end;
>>>>>> 
>>>>>> 
>>>>>> procedure TForm1.btnStopClick(Sender: TObject);
>>>>>> begin
>>>>>>    PostMessage(Server1.Handle, WM_QUIT, 0, 0);
>>>>>>    FListenThread.WaitFor;
>>>>>>    FreeAndNil(FListenThread);
>>>>>>   => here the Server1.Handle is not 0!
>>>>>>    Server1.ThreadAttach; // so raises an exception
>>>>>> end;
>>>>>> 
>>>>>> Any idea?
>>>>>> 
>>>>>> ---
>>>>>> Arno Garrels [TeamICS]
>>>>>> http://www.overbyte.be/eng/overbyte/teamics.html
>>>>>> 
>>>>>> --
>>>>>> 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
>>>> --
>>>> 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
>> --
>> 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
-- 
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