Thread Kill delegate (or something like that)

S

sheperson

Hi,
When I create a new Thread and start it and after a while I kill the
thread, how can I auto-invoke a method upon killing the thread?
I mean is there a delegate or something to use when the thread is
killed to call a method?
Thanks in advance.
 
P

Peter Duniho

Hi,
When I create a new Thread and start it and after a while I kill the
thread, how can I auto-invoke a method upon killing the thread?
I mean is there a delegate or something to use when the thread is
killed to call a method?

Don't kill a thread.

Instead, design the thread code correctly so that it can be signaled to
exit itself. Then the thread itself can raise an event you've defined to
signal that it's been terminated.

Pete
 

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