Newsgroups : Borland : borland.public.delphi.internet.winsock : 2006 Mar : Re: TIdTCPServer - threads, global data
| Subject: | Re: TIdTCPServer - threads, global data |
| Posted by: | "Mathijs" (blab..@bla.hu) |
| Date: | 16 Mar 2006 00:51:49 |
15 mrt 2006, (Remy Lebeau (TeamB)):
> That is NOT safe, for two reasons:
Oh, my... *shocked*
> To serialize an operation with the main thread, especially since you
> are having the connection thread wait for the operation to finish, you
> need to use the TIdSync class instead.
Thanks. Your example looks straightforward. I think I go this way.
> Now, with all of that said, I have to wonder why you are making the
> main thread do all of the parsing. Why not do it inside the OnExecute
> event handler directly?
Since this is my first indy/thread (hobby)-project, I'm not too sure. The
server is a platform where AI can challenge other AI (for example in a
card game). 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. It seems that this is not thread safe and needs to be done in
one thread, right?
Cheers,
M.