Hi guys,
Sorry if the question is too basic but this is something that made me spent way more time that I expected.
I am making a tcp server that attempts to be a dedicated game message server. I want to try a design that has a dedicated thread for the input of all input ports of all sockets and another thread for dedicated writing. I am deliberately trying to avoid having a thread for I/O on each socket connection.
After some experimentation I came out to the realization that the reading thread is blocking all other threads. And I actually just found that stated on the TCP Unit documentation:
-
Blocking I/O will block all threads, except for some socket operations (see the section about the tcp unit). An exception is the read-eval-print loop on UNIX platforms: waiting for input will not block other threads, provided the current input port reads input from a console.
So, I guess my question is if there is a way to workaround this or I have to combine my code with some C++ code to achieve what I want to do?
I am aware of the mailbox-threads but it seems to me that they are actually are having a thread per connection which is what I was trying to avoid.
Thanks in advance,
Pedro.
--