Well, it is locking on two different things, I can't see why you would need
to do this, however.

On Mon, Nov 30, 2009 at 4:09 PM, Steve Strong <[email protected]> wrote:

> (another) quick question:  In the various caches used for holding Query
> Plans, there's lots of code like this:
>
>                public object this[object key]
>                {
>                        [MethodImpl(MethodImplOptions.Synchronized)]
>                        get
>                        {
>                                lock (SyncRoot)
>                                {
>                                        object result =
> softReferenceCache[key];
>                                        if (result != null)
>                                        {
>
>  strongReferenceCache.Add(key, result);
>                                        }
>                                        return result;
>                                }
>                        }
>                }
>
> Is there any good reason for the two locks?  Seems to me to just be
> unnecessary overhead, but I'm perhaps missing something subtle...
>
> Cheers,
>
> Steve
>
>

Reply via email to