Facebook
From Filip Wicha, 5 Years ago, written in C#.
Embed
Download Paste or View Raw
Hits: 242
  1. using System;
  2. using System.Threading;
  3.  
  4. namespace _2
  5. {
  6.     class Program
  7.     {
  8.         static void f()
  9.         {
  10.             int x = 0;
  11.             x++;
  12.         }
  13.  
  14.         static void Main(string[] args)
  15.         {
  16.             int threadCounter = 0;
  17.             while(true)
  18.             {
  19.                 Thread t1 = new Thread(f);
  20.  
  21.                 threadCounter++;
  22.                 t1.Start();
  23.                 Console.WriteLine("Number of threads:   " + threadCounter);
  24.             }
  25.             Console.ReadLine();
  26.         }
  27.     }
  28. }
  29.