All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.sonar.plugins.csharp.S3889.html Maven / Gradle / Ivy

There is a newer version: 10.2.0.105762
Show newest version

Why is this an issue?

Thread.Suspend and Thread.Resume can give unpredictable results, and both methods have been deprecated. Indeed, if Thread.Suspend is not used very carefully, a thread can be suspended while holding a lock, thus leading to a deadlock.

There are other synchronization mechanisms that are safer and should be used instead, such as:

  • Monitor provides a mechanism that synchronizes access to objects.
  • Mutex provides a mechanism that synchronizes interprocess access to a protected resource.
  • Semaphore provides a mechanism that allows limiting the number of threads that have access to a protected resources concurrently.
  • Events enable a class to notify others when something of interest occurs.

Resources

Documentation

Articles & blog posts





© 2015 - 2024 Weber Informatics LLC | Privacy Policy