Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- namespace test
- {
- class MainClass
- {
- public volatile static int maxThreads = 1000;
- public volatile static int currentThreads = 0;
- public static void Main (string[] args)
- {
- while (true) {
- for (int i = 0; i < maxThreads - currentThreads; ++i) {
- Thread t = new Thread (new ThreadStart (bla));
- t.IsBackground = true;
- t.Start ();
- }
- Console.WriteLine (currentThreads);
- Thread.Sleep(100);
- }
- }
- public static void bla()
- {
- currentThreads++;
- currentThreads--;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement