Restarting a thread in .NET (using C#)

后端 未结 7 2347
再見小時候
再見小時候 2020-12-06 01:28

I\'m looking for a way to restart a thread that has been stopped by Abort()..

public partial class MyProgram : Form
{
  private Thread MyThread = new Thread(         


        
7条回答
  •  忘掉有多难
    2020-12-06 01:50

    The simple answer is, you can't. Once a thread has been aborted, you can't restart it. Just create a method or something, that returns a Thread object just how you need it. When you need a new Thread, just get it from that method.

提交回复
热议问题