Last active
February 7, 2022 19:51
-
-
Save hkucuk/885fe35a999dde8c2380f358f67db386 to your computer and use it in GitHub Desktop.
Revisions
-
hkucuk revised this gist
Feb 7, 2022 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -29,7 +29,7 @@ Thread.Sleep(3000); Console.WriteLine("Main thread 1. sinyali gönderdi"); ms.Set(); ms.Reset(); //Nesne unsignaled duruma getirilir Thread.Sleep(3000); Console.WriteLine("Main thread 2. sinyali gönderdi"); ms.Set(); -
hkucuk created this gist
Feb 7, 2022 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,37 @@ var ms = new ManualResetEvent(false); var t1 = new Thread(new ParameterizedThreadStart(x => { Console.WriteLine("1 numaralı thread 1. sinyali sinyal bekliyor"); ms.WaitOne(); Console.WriteLine("1 numaralı thread 1. sinyali aldı"); Console.WriteLine("1 numaralı thread 2. sinyali sinyal bekliyor"); ms.WaitOne(); Console.WriteLine("1 numaralı thread 2. sinyali aldı"); })); t1.Start(); var t2 = new Thread(new ParameterizedThreadStart(x => { Console.WriteLine("2 numaralı thread 1. sinyali sinyal bekliyor"); ms.WaitOne(); Console.WriteLine("2 numaralı thread 1. sinyali aldı"); Console.WriteLine("2 numaralı thread 2. sinyali sinyal bekliyor"); ms.WaitOne(); Console.WriteLine("2 numaralı thread 2. sinyali aldı"); })); t2.Start(); Thread.Sleep(3000); Console.WriteLine("Main thread 1. sinyali gönderdi"); ms.Set(); ms.Reset(); Thread.Sleep(3000); Console.WriteLine("Main thread 2. sinyali gönderdi"); ms.Set(); Console.WriteLine("Main thread bitti");