Threading — understanding the volatile modifier in C#

Whilst work­ing on Bingo.Net I have come across a num­ber of con­cur­ren­cy issues which must be fair­ly com­mon in syn­chro­nous mul­ti­play­er games. Dur­ing my attempts to over­come these obsta­cles I came across the volatile mod­i­fi­er in C# which at first glance looked like a sil­ver­bul­let for all con­cur­ren­cy prob­lems, but under clos­er inspec­tion it more …

Thread­ing — under­stand­ing the volatile mod­i­fi­er in C#Read More »

Thread-safe enumeration in C#

I had a prob­lem with the project I’m work­ing on at work where on the base class I had a list which its child class­es need to have access to in a read-only capac­i­ty but manip­u­la­tion to the list itself is han­dled by the base class only. How­ev­er, the stan­dard C# List<T> and Enumerator<T> are …

Thread-safe enu­mer­a­tion in C#Read More »

Threading — Using ReaderWriterLockSlim

When deal­ing with concurrency/threading issues in .Net, the nor­mal approach is to use lock() to lock a ded­i­cat­ed sync object like this: This is an effi­cient, sim­ple and well proven way to get thread-safe­­ty in .Net and is prob­a­bly all you’ll ever need in your project. How­ev­er, as this approach ensures only one thread can …

Thread­ing — Using Read­er­Writer­Lock­SlimRead More »

By continuing to use the site, you agree to the use of cookies. more information

The cookie settings on this website are set to "allow cookies" to give you the best browsing experience possible. If you continue to use this website without changing your cookie settings or you click "Accept" below then you are consenting to this.