¡@

Home 

c# Programming Glossary: synclock

Do I need to lock or mark as volatile when accessing a simple boolean flag in C#?

http://stackoverflow.com/questions/1222184/do-i-need-to-lock-or-mark-as-volatile-when-accessing-a-simple-boolean-flag-in-c

to have your own locking object as a field readonly object syncLock new object and lock on this. For an example of how badly it..

DataGridView not showing properites of objects which implement ICustomTypeDescriptor

http://stackoverflow.com/questions/1468840/datagridview-not-showing-properites-of-objects-which-implement-icustomtypedescri

typeof PropertyBag private static readonly object syncLock new object public static void AddProperty string name Type type.. string name Type type params Attribute attributes lock syncLock append the new prop into a new collection so that downstream..

Why do I need the Singleton design pattern?

http://stackoverflow.com/questions/482594/why-do-i-need-the-singleton-design-pattern

private Random _random new Random private static object syncLock new object protected LoadBalancer _servers.Add ServerI _servers.Add.. LoadBalancer GetLoadBalancer if _instance null lock syncLock if _instance null _instance new LoadBalancer return..

C# version of java's synchronized keyword?

http://stackoverflow.com/questions/541194/c-sharp-version-of-javas-synchronized-keyword

option is to use your own locks private readonly object syncLock new object public void SomeMethod lock syncLock code Note that.. object syncLock new object public void SomeMethod lock syncLock code Note that for field like events the locking implementation..

Random number generator only generating one random number

http://stackoverflow.com/questions/767999/random-number-generator-only-generating-one-random-number

Random random new Random private static readonly object syncLock new object public static int RandomNumber int min int max lock.. object public static int RandomNumber int min int max lock syncLock synchronize return random.Next min max Edit see comments why..

Maintaining an open Redis connection using BookSleeve

http://stackoverflow.com/questions/8645953/maintaining-an-open-redis-connection-using-booksleeve

RedisConnectionGateway _instance private static object syncLock new object private static object syncConnectionLock new object.. Current get if _instance null lock syncLock if _instance null _instance new RedisConnectionGateway..

SpinWait vs Sleep waiting. Which one to use?

http://stackoverflow.com/questions/9719003/spinwait-vs-sleep-waiting-which-one-to-use

I'd hook an is it full mechanism private readonly object syncLock new object public bool WaitUntilFull int timeout if CollectionIsFull.. return true I'm assuming we can call this safely lock syncLock if CollectionIsFull return true return Monitor.Wait syncLock.. if CollectionIsFull return true return Monitor.Wait syncLock timeout with in the put back into the collection code if CollectionIsFull..