lucenenet-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rob Cecil <rob.ce...@gmail.com>
Subject Re: RAMDirectory code - locking?
Date Tue, 19 Mar 2013 21:16:08 GMT
I think the question is more about Lock(this) rather than
Lock(mySimpleObject), e.g.:

http://stackoverflow.com/questions/2319286/what-to-pass-to-the-lock-keyword


On Tue, Mar 19, 2013 at 4:38 PM, Anders Lybecker <anders@lybecker.com>wrote:

> Hi Brad,
>
> I'm not really sure what your question is?
>
> Is use of the C# Lock keyword safe in RamDirectory? Yes it is. Is it a
> performance issue? No, not really. It is common in multi-threaded code
>
> Regards,
> Anders Lybecker
>
>
> On Tue, Mar 19, 2013 at 6:22 PM, Allan, Brad (Wokingham) <
> Brad.Allan@fiserv.com> wrote:
>
> > There are a number of
> >
> > 'lock (this)'
> >
> > statements in the code?
> >
> >
> >
> > Just wanting to check this has been considered and was considered safe.
> >
> >
> >
> > I'm used to seeing the use of some sort of Locker object to do this.
> >
> >
> >
> > Public class Bla {
> >
> >          private static Object locker = new Object();
> >
> >
> >
> >          Public void someMethod() {
> >
> >                  Lock(locker) {
> >
> >                           //do some stuff!
> >
> >                  }
> >
> >          }
> > }
> >
> > Brad Allan
> > Development Lead
> > Risk & Compliance
> > Fiserv
> > Office: +44 (0) 845 013 1137
> > Mobile: +44 (0) 7866 720024
> > www.fiserv.com<http://www.fiserv.com/>
> >
> >
> > ________________________________
> >
> > CheckFree Solutions Limited (trading as Fiserv)
> > Registered Office: Eversheds House, 70 Great Bridgewater Street,
> > Manchester, M15 ES
> > Registered in England: No. 2694333
> >
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message