Hello All,

I'm working on a little client server program, and i could use a little
help on the threading/synapse model i'm working on.

I have a synapse socket in a thread that only listens for incoming
connections. When there is an incoming connection it accepts it and creates
a class (TConnection) containing the client socket.

I have a threadpool with threads that should call a method (DoWork) on the
TConnection that do the actual reading / writng on the client socket.

Now my question:

Currently all threads in the threadpool are constantly calling the
TConnection to see if there is waiting data. This makes no sense.

How would you guys solve this?


I was thinking about a second thread, which only does one thing: constantly
loop all the TConnections to see if there is waiting data, and ifso, put it
on a todo-list. This way the actual workers could all go to sleep until
there is work on the todo-list. Does this make any sense?

I hope I make any sense in my mail :-)
Anyone willing to give some advice?

Regards,
Rimmert
--
_______________________________________________
Lazarus mailing list
[email protected]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

Reply via email to