[Opensim-dev] .NET / Mono lock(obj) statement
Justin Clark-Casey
jjustincc at googlemail.com
Wed Jan 14 14:47:54 UTC 2009
Homer Horwitz wrote:
> Hi Diva,
>
> On Wed, Jan 14, 2009 at 5:57 AM, Diva Canto <diva at metaverseink.com> wrote:
>> Here's a simplified version of the problem:
>>
>> lock (a)
>> {
>> foo();
>> }
>>
>> void foo()
>> {
>> lock (a)
>> {
>> ...
>> }
>> }
> I just tried that with Mono 2.0.1, and it works correctly (i.e. it
> doesn't deadlock). I used an instance variable object a = new object()
> for the lock.
>
Yeah that is odd. If mono had a general bug of this nature then OpenSim would lock up almost immediately after starting
(well, some may say that it does this anyway (joke!)).
I don't think that we can remove locking long term as done in r8041. On a strict reading of the Dictionary class
definition, this operation is not thread safe. And I've heard that this is actually the case in the underlying bytecode
(an addition/removal operation could change the index whilst the code is within the indexing operation). Even if it
isn't, this isn't something that we should rely on.
>> (the real situation is a bit more complicated; foo() involves a
>> delegate; but ignore that)
> Is this maybe necessary to get the (wrong) result? Or did you use
> another Mono version?
>
> Cheers,
> Homer
> _______________________________________________
> Opensim-dev mailing list
> Opensim-dev at lists.berlios.de
> https://lists.berlios.de/mailman/listinfo/opensim-dev
>
--
justincc
Justin Clark-Casey
http://justincc.wordpress.com
More information about the Opensim-dev
mailing list