[Mono-devel-list] Threading bug?
Simon Ask Ulsnes
simon at ulsnes.dk
Mon Mar 10 13:52:59 EST 2003
I was just writing a tiny Internet server program (one of those which tell you
"Hello" when you telnet them). I had in mind from the beginning, that it was
supposed to be multi-threaded so that I could support multiple clients at a
The server works perfect - as long as I connect only one client. If I try and
connect more clients, all of them hang up until the previous was
The theory behind the program is to have a while(true)-loop in which a
TcpListener accepts connections, starting a new thread handling each incoming
But the loop doesn't continue when a connection has been made, it waits for
the handler to finish.
Since I am pretty sure this works on .NET Framework 1.0 on Windows, I figure
it is a bug in the Threading-classes.
The while(true)-loop looks like this:
And one more strange thing, the num_connections int is actually being
incremented. Perhaps the ThreadPool.QueueUserWorkItem()-method is waiting for
the previous QueueUserWorkItem() to finish?
If this is a bug in my program, I am deeply sorry for the inconvenience...
Simon Ask Ulsnes, Denmark
More information about the Mono-devel-list