5,337
edits
(Created page with " ==Multithreading== ===Theadpool=== C# has a convenient [https://docs.microsoft.com/en-us/dotnet/api/system.threading.threadpool?view=netframework-4.8 TheadPool] class in th...") |
No edit summary |
||
Line 15: | Line 15: | ||
ManualResetEvent finishedHandle = new ManualResetEvent(false); | ManualResetEvent finishedHandle = new ManualResetEvent(false); | ||
for (int i = 0; i < numberOfTasks; i++) { | for (int i = 0; i < numberOfTasks; i++) { | ||
ThreadPool.QueueUserWorkItem(_ = > { | ThreadPool.QueueUserWorkItem(_ = > { | ||
try { | try { | ||
Line 28: | Line 27: | ||
}); | }); | ||
} | } | ||
// Blocking wait. | // Blocking wait. | ||
finishedHandle.WaitOne(); | finishedHandle.WaitOne(); |