TheBulgarianWolf

Entering The Thread Pool Without Using TPL

Nov 21st, 2020
1,005
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.53 KB | None | 0 0
  1. using System;
  2. using System.Threading;
  3. using System.Threading.Tasks;
  4.  
  5. namespace MoreMethodExercises
  6. {
  7.     class Program
  8.     {
  9.         static void Main()
  10.             {
  11.                 ThreadPool.QueueUserWorkItem(Go);
  12.                 ThreadPool.QueueUserWorkItem(Go, 123);
  13.                 Console.ReadLine();
  14.             }
  15.  
  16.             static void Go(object data)   // data will be null with the first call.
  17.             {
  18.                 Console.WriteLine("Hello from the thread pool! " + data);
  19.             }
  20.        
  21.     }
  22. }
  23.  
Add Comment
Please, Sign In to add comment