[Mono-dev] Double check locking pattern in Mono? (was: Some notes from my use of Gengarme...)
Zoltan Varga
vargaz at gmail.com
Tue May 13 12:41:43 EDT 2008
AFAIK, the double-checking locking pattern is safe in C# if it is done using
memory barriers:
http://blogs.msdn.com/brada/archive/2004/05/12/130935.aspx
Zoltan
On Tue, May 13, 2008 at 4:58 PM, knocte <knocte at gmail.com> wrote:
> > On Apr 28, 5:53 pm, Sebastien Pouliot <sebastien.poul... at gmail.com>
> > wrote:
> >
> >> On Mon, 2008-04-28 at 08:23 -0700, knocte wrote:
> >> > (BTW, are we sure that Mono implements this the same way
> >> > as .NET?).
> >
> >> This is indeed the right question.
> >
> >> The same issue was discussed on another thread (a bit more recent) and
> >> it's something that needs to be validated with the runtime guys (I do
> >> remember Zoltan asking me to change a double-lock, albeit a long time
> >> ago, in CryptoConfig).
> >
> >> I'll a bit short on time this week (got a presentation to finish/present
> >> in two days and stretched a bit my free time this weekend for the rule
> >> day) but feel free to bring the discussion to mono-devel, I'll join in
> >> later :-)
> >
> > Mmm, thanks for warning us Sebastien! I agree we should push this to
> > mono-devel but, regardless of this runtime topic, come to think of it,
> > we should change the rule anyway, because otherwise Gendarme would
> > rely on a bug (if Mono doesn't implement this like .NET, it's a bug,
> > because I guess it's included in the CLR spec). Besides, Gendarme is
> > supposed to target any .NET implementation, right? And doing a double-
> > check is just harmless in the case Mono doesn't mimic .NET's CLR (and
> > maybe it's better to have your own code conformant to .NET standards,
> > this way you won't have to modify it in the future when Mono gets
> > fixed).
> >
>
> Hey, sorry for not having brought this to mono-devel until now, but I
> was curious to the answer to the above. However, nobody has answered
> but, anyway, today I've just seen a commit in the runtime that may be
> related to this issue:
>
> http://lists.ximian.com/pipermail/mono-patches/2008-May/117918.html
>
> Zoltan, can we then consider that Mono mimics .NET in this aspect:?
> http://msdn2.microsoft.com/en-us/library/ms998558.aspx
>
> Is there a bugzilla bug open for this?
>
> FYI, the original thread:
> http://groups.google.com/group/gendarme/browse_thread/thread/b46d1ddc3a2d8fb9#msg_9b9c2989cedb4c34
>
> Thanks!
>
> Andres
>
> --
>
More information about the Mono-devel-list
mailing list