C#

C#

Made by DeepSource

Usage of deprecated Threading APIs CS-W1002

Bug risk
Critical

Threading APIs such as CurrentThread.Resume() and CurrentThread.Suspend() are deprecated and no longer maintained. It is therefore recommended that you switch to other classes in System.Threading, such as Monitor, Mutex, Event, or Semaphore, to synchronize Threads or protect resources.

Bad practice

CurrentThread.Suspend();
// Process something
CurrentThread.Resume();

Recommended

Monitor.Enter(lock);
// Process something
Monitor.Exit(lock);

References: