ReaderWriterLock.AcquireWriterLock : ReaderWriterLock « System.Threading « C# / C Sharp by API





ReaderWriterLock.AcquireWriterLock

  

using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime;
using System.Runtime.CompilerServices;
using System.Security;
using System.Text;
using System.Threading;

public class MainClass
{
    
    public static void Main()
    {
       ReaderWriterLock rwLock = new ReaderWriterLock();

        rwLock.AcquireWriterLock(250);
        if (rwLock.IsWriterLockHeld)
        {
            Console.WriteLine("Writer lock held");
            rwLock.ReleaseWriterLock();
        }

        rwLock.ReleaseWriterLock();

    }
}

   
    
  










Related examples in the same category

1.ReaderWriterLock.DowngradeFromWriterLock
2.ReaderWriterLock.IsReaderLockHeld
3.ReaderWriterLock.IsWriterLockHeld
4.ReaderWriterLock.ReleaseReaderLock()