private void copyFile(string dirName1, string dirName2, string[] files) { string[] arr; foreach (string file in files) { arr = file.Split('\\'); poolQueue.EnqueueTask(this, file, dirName2 + "\\" + arr[arr.Length - 1]); } }
static void Main(string[] args) { PoolQueue PoolQueue = new PoolQueue(3); for (int i = 0; i < 10; i++) { PoolQueue.EnqueueTask(doSmth); } Console.ReadLine(); }
static void Main(string[] args) { PoolQueue PoolQueue = new PoolQueue(3); Console.WriteLine("current proc id = " + Thread.CurrentThread.ManagedThreadId); for (int i = 0; i < 10; i++) { PoolQueue.EnqueueTask(doSmth); } Console.ReadLine(); }