可能な重複質問:私のコードでIs there a way to indefinitely pause a thread?再開C#のスレッド
は、私はそれが中断されてhasntとき、私は履歴書を呼び出すので、私は以下の例外を取得
Thread mainThread
//...
mainThread.Resume();
void StartThread()
{
while (!wantQuit)
{
db.runEmail();
mainThread.Suspend();
}
}
の下に行います。
System.Threading.ThreadStateException
私はこの警告
warning CS0618: 'System.Threading.Thread.Resume()' is obsolete: 'Thread.Resume has been deprecated. Please use other classes in System.Threading, such as Monitor, Mutex, Event, and Semaphore, to synchronize Threads or protect resources. http://go.microsoft.com/fwlink/?linkid=14202'
に気づくので、私はそれが中断されていない例外/ケースを再開し、無視するが方法ですかしら?私は、下記の代わりに、ちょうど1行
try
{
mainThread.Resume();
}
catch (System.Threading.ThreadStateException e)
{
}