[Mono-devel-list] Threading bug?

Torstensson, Patrik patrik.torstensson at intel.com
Mon Mar 10 14:19:55 EST 2003


Hi,

What version of Mono are you using? There was a bug until the 0.21
release.

Cheers,
 Patrik

> -----Original Message-----
> From: Simon Ask Ulsnes [mailto:simon at ulsnes.dk] 
> Sent: Monday, March 10, 2003 7:53 PM
> To: mono-devel-list at lists.ximian.com
> Subject: [Mono-devel-list] Threading bug?
> 
> 
> Hello there,
> 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 
> time.
> 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 
> disconnected...
> 
> 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 
> connection.
> 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:
> while (listening)
> {
> 	ThreadPool.QueueUserWorkItem(new 
> WaitCallback(HandleConnection), 
> listener.AcceptSocket());
> 	num_connections++;
> }
> 
> 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...
> 
> Yours sincerely,
> Simon Ask Ulsnes, Denmark
> 
> _______________________________________________
> Mono-devel-list mailing list
> Mono-devel-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-devel-list
> 



More information about the Mono-devel-list mailing list