[Mono-dev] ObjectPool

Jérémie Laval jeremie.laval at gmail.com
Wed Jul 25 11:43:29 UTC 2012


There were indeed two bugs in there, a missing barrier and the issue you
described.

I also commented out the code if you want more details.

--
Jérémie Laval
http://neteril.org



On Wed, Jul 25, 2012 at 11:54 AM, Greg Young <gregoryyoung1 at gmail.com>wrote:

> We have had some moving forward in our mono stability issues. I
> figured I would start up a chat here about one place that seems to be
> causing many problems.
>
>
>
> https://github.com/mono/mono/blob/master/mcs/class/corlib/System.Collections.Concurrent/ObjectPool.cs
>
> I am not really sure the code here is actually thread safe... Maybe it
> doesn't need to be for some reason?
>
> We have added volatiles for add/remove index (yuriy pointed out that
> threads were often stuck at line 86) but even with that im still not
> sure its actually threadsafe. There are some weird edge conditions
> that seem to be here (like if CompareExchange fails 3 times it will
> just never set the remove index and continue on).
>
> Somebody has obviously spent a lot of time thinking about this code
> and optimizing it. I want to make sure we get the full "why" behind
> things so we dont a) waste time b) introduce issues.
>
> Greg
>
> --
> Le doute n'est pas une condition agréable, mais la certitude est absurde.
> _______________________________________________
> Mono-devel-list mailing list
> Mono-devel-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-devel-list
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ximian.com/pipermail/mono-devel-list/attachments/20120725/84efbab1/attachment.html>


More information about the Mono-devel-list mailing list