Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Threading;
- namespace DynamicThreads
- {
- class Program
- {
- static void SomeFunction(int x)
- {
- Console.WriteLine("Vlakno {0}", x);
- }
- static void Main(string[] args)
- {
- List<Thread> threads = new List<Thread>();
- for (int i = 0; i < 10; i++)
- {
- threads.Add(new Thread(() => SomeFunction(i)));
- threads[i].Start();
- }
- Console.Read();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment