Task.WaitAll() not working as expected

前端 未结 3 2166
暗喜
暗喜 2021-01-05 19:37

I\'m trying to figure out how to work with the Task class. In the past I have always used the regular Thread class, but I\'m trying to grasp all of the asynchronous programm

3条回答
  •  [愿得一人]
    2021-01-05 19:55

    Task.WaitAll blocks and waits for all task to complete and you are calling it on the UI thread.

    All your task are trying to call richTextBox1.Invoke (in the UI thread) but your UI thread is blocked in Task.WaitAll. Deadlock.

提交回复
热议问题