> I found one little problem, sorry my fault:

OK.

> With your exception handling we could also let the exception thru in
> order to terminate the thread?

This would affect other clients running in the same thread.
Currently I don't know if it is better or not.
I don't like the idea of silently ignoring any exception. It conduce to bugs 
which are very difficult to find. We should find a case where an exception 
is raised within DetachClient and analyse the reason to decide how to handle 
it. So at the moment I think it is better to let the exception flow thru to 
terminate the thread. This is more visible the day the exception occur.

--
[EMAIL PROTECTED]
http://www.overbyte.be


----- Original Message ----- 
From: "Arno Garrels" <[EMAIL PROTECTED]>
To: "ICS support mailing" <[email protected]>
Sent: Sunday, November 06, 2005 1:22 PM
Subject: Re: [twsocket] Multi threading server component


> Francois PIETTE wrote:
>> I also solved an issue when an exception is raised in the worker thread,
>> outside of an TWSocket event handler (those exceptions are catched by
>> OnBgException). When an exception is raised in the worker thread, it is
>> catched, the clients are aborted, a new event OnThreadException is
>> triggered and the thread is terminated.
>
> It becomes more and more a very interisting class :)
>
> I found one little problem, sorry my fault:
>
> procedure TWSClientThread.DetachClient(Client: TWSocketThrdClient);
> var
>    I : Integer;
> begin
>    try
>        if Assigned(Client) then
>        try
>            Client.ThreadDetach;
> =>          Client.FClientThread := nil;
>        except
> =>          Client.FClientThread := nil;
>        end;
>    finally
> <=      //Client.FClientThread := nil;
>        I := FClients.IndexOf(Client);
>        if I > -1 then
>            FClients.Delete(I);
>    end;
> end;
>
> I'm not sure whether it's OK to ignore an possible exception in
> ThreadDetach or not, it _may_ be safe.
> With your exception handling we could also let the exception thru in
> order to terminate the thread?
>
> procedure TWSClientThread.DetachClient(Client: TWSocketThrdClient);
> var
>    I : Integer;
> begin
>    try
>        if Assigned(Client) then
>        try
>            Client.ThreadDetach;
>        finally
>            Client.FClientThread := nil;
>        end;
>    finally
>        I := FClients.IndexOf(Client);
>        if I > -1 then
>            FClients.Delete(I);
>    end;
> end;
>
> {* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 
> *}
>
> -- 
> 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