> I found another decision. Nnow I create HtthCli before creating
> TBaseThread and put reference of it in TBaseThread.create.

There is another issue you seems to ignore. A thread context is not related
at all to the TThread class. It is not because you run a TThread method that
it runs within the conext of the thread created by the TThread class !

A method is executed in the context of a thread only if it is called from
the Execute method (or any method called directly or indirectly by that
execute method). You can have any thread calling any method in a TThread
class instance but then the method is executed within the context of the
CALLING thread, not the context of the thread created by the class.

Speaking ICS components and events, the events are executed in the thread
context which CREATED the component (or the thread attached using
ThreadAttach method). No matter where the event handler is defined. This is
how Windows works.

Contribute to the SSL Effort. Visit http://www.overbyte.be/eng/ssl.html
--
[EMAIL PROTECTED]
Author of ICS (Internet Component Suite, freeware)
Author of MidWare (Multi-tier framework, freeware)
http://www.overbyte.be


----- Original Message ----- 
From: "Anatoly Podgoretsky" <[EMAIL PROTECTED]>
To: "ICS support mailing" <twsocket@elists.org>
Sent: Friday, October 06, 2006 9:46 AM
Subject: Re: [twsocket] How to use THttpCli with threads?


> Hi Arno and Francois,
>
> I understood my my mistake. I think that TBaseThread.Create is thread
context and it is wrong.
> I found another decision. Nnow I create HtthCli before creating
TBaseThread and put reference of it in TBaseThread.create. When TBaseThread
terminate I free instanse of HtthCli in OnTerminate Event handler/
> I 'll look for multithread sample programs for better understanding a
technology.
>
> What about TBaseThread.Destroy in wich context it execute? In context of
thread?
>
> With best regards,
> Anatoly Podgoretsky
>
> ----- Original Message ----- 
> From: "Francois Piette" <[EMAIL PROTECTED]>
> To: "ICS support mailing" <twsocket@elists.org>
> Sent: Friday, October 06, 2006 10:11 AM
> Subject: Re: [twsocket] How to use THttpCli with threads?
>
>
> >> What I'm doing wrong?
> >
> > Your HTTP component runs in the main thread since you created in the
context
> > of the main thread (TThread constructor execute in the context of the
> > calling thread, not in the context of the created thread). Create you
HTTP
> > component instance from the thread's Execute method and free it at the
end
> > of the Execute method. Don't forget to have a message pump within your
> > Execute method also. Look at the multithread sample programs delivered
with
> > ICS. See their creation date. Generally to more recent the better they
are.
> -- 
> 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