TheBulgarianWolf

Join and Sleep Example

Nov 20th, 2020
608
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.56 KB | None | 0 0
  1. using System;
  2. using System.Threading;
  3.  
  4. namespace MoreMethodExercises
  5. {
  6.     class Program
  7.     {
  8.         static void Main(string[] args)
  9.         {
  10.             Thread t = new Thread(Go);
  11.             t.Start();
  12.             t.Join();
  13.             Thread.Sleep(5000);
  14.             Console.WriteLine("Thread t has ended!");
  15.             Console.ReadLine();
  16.         }
  17.  
  18.         static void Go()
  19.         {
  20.            for(int i = 0; i < 1000; i++)
  21.             {
  22.                 Console.Write("y");
  23.             }
  24.             Console.WriteLine();
  25.         }
  26.     }
  27. }
Add Comment
Please, Sign In to add comment