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

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?
 
W

Willy Denoyette [MVP]

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top