/// <summary>
 /// Bathroom
 /// 
 /// Setting up the conditions of the bathroom and the solution of the Starvation problem
 /// </summary>
 public Bathroom()
 {
     BathroomSemaphore = new Semaphore (1);
     MLightSwitch = new Lightswitch (BathroomSemaphore);
     FLightSwitch = new Lightswitch (BathroomSemaphore);
     QueueTS = new Semaphore (1);
     PopCounter = new Semaphore (3);
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="Mark.Utilities.MAC.ReaderWriter"/> class.
 /// 
 /// This Initializes the Reader Writer. All this will do is Initialize all of the global variables for the class to work.
 /// </summary>
 public ReaderWriter()
 {
     ReaderWriterLockSemaphore = new Semaphore (1);
     ReaderWriterLockLightswitch = new Lightswitch (ReaderWriterLockSemaphore);
     ReaderBlock = new Semaphore (1);
     WriteBlock = new Semaphore (1);
     NumberOfReaders = 0;
     ReaderWriterLock = new object ();
 }
        public void TestStart()
        {
            semaphore = new Semaphore(0);
            LightswitchTest = new Lightswitch (semaphore);

            Thread releaseToken = new Thread(ReleaseToken);
            Thread releaseTask = new Thread(AquireTokenLightSwitch);
            Thread releaseTask1 = new Thread(AquireTokenLightSwitch);
            Thread releaseTask2 = new Thread(AquireTokenSemaPhore);
            Thread releaseTask3 = new Thread(AquireTokenSemaPhore);
            Thread releaseTask4 = new Thread(AquireTokenLightSwitch2);
            Thread releaseTask5 = new Thread(AquireTokenLightSwitch2);
            releaseToken.Start ();
            releaseTask.Start();
            releaseTask1.Start ();
            releaseTask2.Start();
            releaseTask3.Start();
            releaseTask4.Start();
            releaseTask5.Start();
        }