Is there a way to wake a sleeping thread?

后端 未结 7 1778
伪装坚强ぢ
伪装坚强ぢ 2021-01-04 05:13

Is there a way to wake a sleeping thread in C#? So, have it sleep for either a long time and wake it when you want work processed?

7条回答
  •  忘掉有多难
    2021-01-04 05:41

    There is actually a thread.Interrupt() method in C#. While the accepted answer does describes a good pattern that you probably want in your case, I came to this question looking for Thread.Interrupt so I am putting it here.

提交回复
热议问题