ReaderWriterLock [modified]
-
By using this, what exactly is locked? A specifiek variable or the thread itself or the variables that have been modified with 'System.Threading.Interlocked.Increment'? I THINK 'THE VARIABLES THAT HAVE BEEN MODIFIED BY THE THREAD'. WRIGHT? If you have the following: public static void Synchronization_WriterLock() { System.Threading.ReaderWriterLock oReaderWriterLock; oReaderWriterLock = new System.Threading.ReaderWriterLock(); miCount = 0; try { oReaderWriterLock.AcquireWriterLock(100); try { System.Threading.Interlocked.Increment(ref miCount); Console.WriteLine(miCount); } finally { oReaderWriterLock.ReleaseWriterLock(); } } catch (ApplicationException e) { Console.WriteLine("Failed to get a Writer Lock"); } } What locks what? -- modified at 17:03 Wednesday 27th December, 2006