Example #1
0
 public static void groupThreadWrite(ConcurrencyUtils.LightSwitch LS)
 {
     while (true)
     {
         LS.Acquire();
         Console.WriteLine("Group thread #" + Thread.CurrentThread.Name);
         Thread.Sleep(3600);
         LS.Release();
     }
 }
Example #2
0
 public static void MutexTestReleaser(ConcurrencyUtils.Mutex mutex)
 {
     while (true)
     {
         Console.WriteLine("\t\t\t" + Thread.CurrentThread.Name + ": Releasing mutex token");
         mutex.Release();
         Thread.Sleep(6000);
     }
 }
Example #3
0
 public static void lonelyThreadWrite(ConcurrencyUtils.Semaphore semaphore)
 {
     while (true)
     {
         semaphore.Acquire();
         Console.WriteLine("I'm a lonely thread");
         Thread.Sleep(100);
         semaphore.Release();
     }
 }
Example #4
0
        public static void SemaphoreTestReleaser(ConcurrencyUtils.Semaphore testSemaphore)
        {
            while (true)
            {
                Console.WriteLine("\t\t\t" + Thread.CurrentThread.Name + ": Releasing 3 tokens");
                testSemaphore.Release(3);
                // Console.ForegroundColor = ConsoleColor.White;

                Thread.Sleep(6000);
            }
        }