Calling Thread.Suspend and it's affect on the target thread...

  • Thread starter Thread starter Paul Tomlinson
  • Start date Start date
P

Paul Tomlinson

Quick question.

If i call Thread.suspend() on a thread does the thread which is being
suspended get any notification that it has been/is being suspended?

I am thinking i want the thread-to-be-suspended to log the fact that it is
being suspended.

Any ideas?
 
Paul Tomlinson said:
Quick question.

If i call Thread.suspend() on a thread does the thread which is being
suspended get any notification that it has been/is being suspended?

I am thinking i want the thread-to-be-suspended to log the fact that it is
being suspended.

Any ideas?

I suggest you don't use Thread.Suspend/Thread.Resume:
1. Both methods are obsolete in v2.0
2. You have no idea what the thread your are suspending is doing when you
suspend it's execution. Using these services are a recipt for deadlocks or
corrupted state, as it can suspend a thread that holds a managed lock, or is
actually executing a type constructor.

Use appropriate synchronization mechanisms based on Monitor and/or
Waithandle.

Willy.
 
Back
Top