Re: [Mono-dev] Dictionary implementation + concurrency

2013-02-04 Thread Rafael Teixeira
Yes, please. Rafael Monoman Teixeira --- The most exciting phrase to hear in science, the one that heralds new discoveries, is not 'Eureka!' (I found it!) but 'That's funny ...' Isaac Asimov US science fiction novelist scholar (1920 - 1992) On Sun, Feb 3,

Re: [Mono-dev] Dictionary implementation + concurrency

2013-02-04 Thread Alan
Hey, As per the 'thread safety' section of the documentation, your code is invalid: http://msdn.microsoft.com/en-us/library/xfhwa508.aspx. This kind of change will not make it safe to use the dictionary in a read/write way from multiple threads, especially not when you have multiple cores and

Re: [Mono-dev] Dictionary implementation + concurrency

2013-02-04 Thread Greg Young
The .NET version does support it for types or reference size or smaller. My guess the reason its not explicitly documented is that its only for types reference or smaller. On Mon, Feb 4, 2013 at 12:40 PM, Alan alan.mcgov...@gmail.com wrote: Hey, As per the 'thread safety' section of the

Re: [Mono-dev] Dictionary implementation + concurrency

2013-02-04 Thread Alan
It's not documented so you're relying on a quirk which may or may not actually work on multi-core systems under heavy load. I'm just saying that it's not worth relying on this as a guarantee as you will break when run on different implementations of the BCL because you're relying on something

Re: [Mono-dev] Dictionary implementation + concurrency

2013-02-04 Thread Daniel Lo Nigro
My guess the reason its not explicitly documented is that its only for types reference or smaller. In this case it sounds like an unintentional implementation detail that shouldn't be relied on? You could probably look at the SSCLI and see if there's any comments around it (but I think that

Re: [Mono-dev] Dictionary implementation + concurrency

2013-02-04 Thread Greg Young
from reading it appears there is actually a possible race condition with 1/n in the .net impl as well so nm On Mon, Feb 4, 2013 at 12:56 PM, Daniel Lo Nigro li...@dan.cx wrote: My guess the reason its not explicitly documented is that its only for types reference or smaller. In this case it

Re: [Mono-dev] Dictionary implementation + concurrency

2013-02-04 Thread Greg Young
tess covers race condition here http://blogs.msdn.com/b/tess/archive/2009/12/21/high-cpu-in-net-app-using-a-static-generic-dictionary.aspx i figured it was only for items ref size. On Mon, Feb 4, 2013 at 1:07 PM, Greg Young gregoryyou...@gmail.com wrote: from reading it appears there is

[Mono-dev] Dictionary implementation + concurrency

2013-02-03 Thread Greg Young
The .NET dictionary implementation is thread safe on reads/updates so long as the internal collection does not grow and size is of reference type or smaller. eg: if you set size to 1m items and had 100k with a fill factor that did not cause an internal growth it would be threadsafe. This assurance