![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks. |
| |||||||
![]() |
| |
| | #1 (permalink) |
| | how to end a thread without an exception? I have a thread that ends with system.threading.thread.currentThread.Abort() method.. .. but, it throws me an exception.. is there any other way to end a thread? |
My System Specs![]() |
| | #2 (permalink) |
| | Re: how to end a thread without an exception? buu <aha@xxxxxx> wrote: Quote: > I have a thread that ends with system.threading.thread.currentThread.Abort() > method.. > . > but, it throws me an exception.. > is there any other way to end a thread? http://pobox.com/~skeet/csharp/threads/shutdown.shtml Basically you should have a *graceful* shutdown mechanism. -- Jon Skeet - <skeet@xxxxxx> http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet World class .NET training in the UK: http://iterativetraining.co.uk |
My System Specs![]() |
| | #3 (permalink) |
| | Re: how to end a thread without an exception? buu wrote: Quote: > I have a thread that ends with system.threading.thread.currentThread.Abort() > method.. > . Quote: > but, it throws me an exception.. > is there any other way to end a thread? > To end a thread from another thread, set a boolean, then have the thread that needs to end check for that boolean and return from its thread routine. The only safe (and dare I say useful) way to end a thread is by explicitly synchronizing. There is no safe way to simply "end" a thread without knowing what it's doing, so it's better to let the thread end itself by signaling it. -- J. |
My System Specs![]() |
| | #4 (permalink) |
| | Re: how to end a thread without an exception? Hello buu, Quote: > I have a thread that ends with > system.threading.thread.currentThread.Abort() > method.. > . > but, it throws me an exception.. > is there any other way to end a thread? So you could trip some internal flag (viewable by the proc) which will allow the procedure to come to a natural end. -- Rory |
My System Specs![]() |
| | #5 (permalink) |
| | Re: how to end a thread without an exception? |
My System Specs![]() |
![]() |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Forum | |||
| How do the current thread get thread notification of OS intruption | .NET General | |||
| Start a new thread from an existing thread, which was started from atimer | .NET General | |||
| Cross-Thread Exception | .NET General | |||
| Exception stack is corrupt when catching and storing the exception | .NET General | |||
| Vista Install Error: Exception Unknown Software Exception | Vista installation & setup | |||