コード例 #1
0
 // Начать выполнение нового потока.
 void Run()
 {
     Console.WriteLine(Thrd.Name + " начат.");
     answer = sa.SumIt(a);
     Console.WriteLine("Сумма для потока " + Thrd.Name + " равна " + answer);
     Console.WriteLine(Thrd.Name + " завершен.");
 }
コード例 #2
0
ファイル: 08_lock.cs プロジェクト: tuyendothanh/git-main
 // Begin execution of new thread.
 void Run()
 {
     Console.WriteLine(Thrd.Name + " starting.");
     answer = sa.SumIt(a);
     Console.WriteLine("Sum for " + Thrd.Name + " is " + answer);
     Console.WriteLine(Thrd.Name + " terminating.");
 }
コード例 #3
0
ファイル: 09_lock.cs プロジェクト: tuyendothanh/git-main
    // Begin execution of new thread.
    void Run()
    {
        Console.WriteLine(Thrd.Name + " starting.");

        // Lock calls to SumIt().
        lock (sa) answer = sa.SumIt(a);
        Console.WriteLine("Sum for " + Thrd.Name + " is " + answer);
        Console.WriteLine(Thrd.Name + " terminating.");
    }
コード例 #4
0
 void Run()
 {
     Console.WriteLine("Thread \"" + this.Thread.Name + "\" start running");
     lock (sa) this.answer = sa.SumIt(this.a);
     Console.WriteLine(
         "Sum for \"" + this.Thread.Name
         + "\" equal " + this.answer
         );
     Console.WriteLine("Thread \"" + this.Thread.Name + "\" end  running");
 }