fork(11) download
  1. using System;
  2. using System.Threading;
  3. public class Test
  4. {
  5. public static void Main()
  6. {
  7. Thread tid1 = new Thread(new ThreadStart(Thread1));
  8. Thread tid2 = new Thread(new ThreadStart(Thread2));
  9.  
  10. tid1.Start();
  11. tid2.Start();
  12. }
  13.  
  14. public static void Thread1()
  15. {
  16. for (int i = 1; i <= 10; i++)
  17. {
  18. Console.Write(string.Format("Thread1 {0}", i));
  19. }
  20. }
  21.  
  22. public static void Thread2()
  23. {
  24. for (int i = 1; i <= 10; i++)
  25. {
  26. Console.Write(string.Format("Thread2 {0}", i));
  27. }
  28. }
  29. }
Success #stdin #stdout 0.04s 28048KB
stdin
Standard input is empty
stdout
Thread1 1Thread1 2Thread1 3Thread1 4Thread1 5Thread1 6Thread1 7Thread1 8Thread1 9Thread1 10Thread2 1Thread2 2Thread2 3Thread2 4Thread2 5Thread2 6Thread2 7Thread2 8Thread2 9Thread2 10