Newsgroups : Borland : borland.public.delphi.internet.winsock : 2006 Mar : Re: TIdTCPServer - threads, global data

www.cryer.info
Managed Newsgroup Archive

Re: TIdTCPServer - threads, global data

Subject:Re: TIdTCPServer - threads, global data
Posted by:"Remy Lebeau (TeamB)" (no.spam@no.spam.com)
Date:Thu, 16 Mar 2006 04:03:48

"Mathijs" <blabla@bla.hu> wrote in message
news:Xns978864922B9BBholleknolle23@207.105.83.66...

> When a client sends the command to retrieve the open tables or
> register for a table, I need to access a global TList of tables, for
> example.

You do not need to delegate that work to the main thread at all.  Use a
TThreadList instead of a TList.  TThreadList wraps a TList with a critical
section.  That way, your connection threads can access the global data
directly, in a thread-safe manner, without making the main thread do all of
the work on behalf of the threads.


Gambit

Replies:

In response to:

www.cryer.info
Managed Newsgroup Archive