3 ms·
How is Task.WaitAll different from Thread.Joining a bunch of threads? Or if you were cancelling tasks, using cancellation tokens?
by lukevp 6y ago
How is Task.WaitAll different from Thread.Joining a bunch of threads? Or if you were cancelling tasks, using cancellation tokens?
- cm2187 6y agoIf you are running Task.WaitAll on a UI thread you are likely to create a deadlock.
- hansvm 6y agoThe other comment alluded to this, but the crux of the problem is that you can schedule a task to run and wait on the completion of that task, but the only available thread for it to run is the one currently waiting for it to complete. The writeup here isn't bad: https://devblogs.microsoft.com/pfxteam/await-and-ui-and-deadlocks-oh-my/ https://devblogs.microsoft.com/pfxteam/await-and-ui-and-dead...