Page 1 of 1

Great concurrency support in .NET for Cobra on Windows

PostPosted: Fri Nov 06, 2009 1:17 pm
by todd.a
I noticed that there is now a System.Collections.Concurrent namespace in .NET 4 beta 2 (didn't catch my attention in beta 1 so it could have been there). This makes Actor style programming a lot easier as the concurrency issues regarding the collection is dealt with for you.

Re: Great concurrency support in .NET for Cobra on Windows

PostPosted: Fri Nov 06, 2009 3:27 pm
by Charles
How about some URLs to go with it? Here is the MSDN page for the namespace:

http://msdn.microsoft.com/en-us/library/system.collections.concurrent(VS.100).aspx

I wonder if these classes could be backported to .NET 2.0 which already has support for threads and locking? Here is Mono's implementation:

http://anonsvn.mono-project.com/source/trunk/mcs/class/corlib/System.Collections.Concurrent/

One other note: You don't have to wait for .NET 4.0 to get easy multi-threading around collections. I did it in Cobra's own test runner by putting a "lock" on an ordinary Queue and accessing its .count and .dequeue methods inside the locked block. 'Twas easy.

Re: Great concurrency support in .NET for Cobra on Windows

PostPosted: Sat Nov 07, 2009 11:15 am
by todd.a
Geez Chuck, I believe the key phrases I used were "a lot easier" and "dealt with for you" meaning, I have no desire to implement code that allows removing from a collection while enumerating it, but if .NET/Mono gives me the ability to, then why not (when needed of course) :D. This convenience lends a hand with regard to common patterns such as the Producer-Consumer pattern too.

Re: Great concurrency support in .NET for Cobra on Windows

PostPosted: Sat Nov 07, 2009 5:06 pm
by Charles
It wasn't a criticism of you or your post. I just wanted to make sure that readers did not get the impression that concurrent programming was not currently available or usable.