C#. Rihter. Use Thread from the thread pool

        static void Main(string[] args)
        {
            Console.WriteLine("this is main thread");
            ThreadPool.QueueUserWorkItem(ThreadWorker, 123);
            Thread.Sleep(3000);
        }

        private static void ThreadWorker(object obj)
        {
            Thread.Sleep(1000);
            Console.WriteLine("hi from thread pool thread");
        }

Result

this is main thread
hi from thread pool thread
This entry was posted in Без рубрики. Bookmark the permalink.