Newsgroups : Borland : borland.public.delphi.internet.winsock : 2006 Sep : Re: Best practice for OnConnect?
| Subject: | Re: Best practice for OnConnect? |
| Posted by: | "Remy Lebeau (TeamB)" (no.spam@no.spam.com) |
| Date: | Thu, 28 Sep 2006 11:22:47 |
"Roberto Meneghini" <rmeneghini@separationsystems.com> wrote in message
news:451bc901@newsgroups.borland.com...
> Every time that a client connects I would like to add an item
> in a TListView component.
Look at the TIdSync or TIdNotify class. Or implement your own inter-thread
messaging system.
> The help for the TIdTCPServer highly discourages the use of
> consuming task (access to VCL components) inside this event.
TIdTCPServer is multi-threaded. The OnConnect event is triggered inside a
worker thread, not the main thread. Access to the UI can only be done
safely from inside the main thread, though.
> Is adding an item to the TListView considered a consuming task?
It is not a matter of "consuming". It is not a thread-safe operation at all
to access the main thread's UI from the context of a worker thread.
Gambit
none