Skip to content

Instantly share code, notes, and snippets.

@JaDogg
Created December 10, 2013 06:47
Show Gist options
  • Save JaDogg/7886666 to your computer and use it in GitHub Desktop.
Save JaDogg/7886666 to your computer and use it in GitHub Desktop.
Run thousand threads !!
using System;
using System.Threading;
namespace ThousandThreads
{
class Thread1000
{
static void Main(string[] args)
{
for (int i = 1; i <=1000; i++)
{
var thread = new Thread(MethodOfThread) {Name = "[" + i.ToString("0000") + "]"};
thread.Start();
}
}
static void MethodOfThread()
{
//
while (true)
{
Console.Write(Thread.CurrentThread.Name);
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment