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:
Monitorprovides a mechanism that synchronizes access to objects.Mutexprovides a mechanism that synchronizes interprocess access to a protected resource.Semaphoreprovides a mechanism that allows limiting the number of threads that have access to a protected resources concurrently.Eventsenable a class to notify others when something of interest occurs.
Resources
Documentation
- Thread.Resume Method
- Thread.Suspend Method
- Monitor Class
- Mutex Class
- Semaphore Class
- Events Programming Guide
- lock statement