If you set a breakpoint on FServer.ThreadDetach, do you get a hit on it when
stopping the server ?
And when you single step into the code, is the handle actually set to 0 ?
--
[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 3: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

Reply via email to