469,626 Members | 877 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,626 developers. It's quick & easy.

Thread Abort?

I need to have an asynch thread abort itself. Something akin to a STOP. The
thread that spawned it cannot access it so it must done within the thread.

Chip
Sep 13 '06 #1
3 1731
Best way is probably to have a field visible to the thread thats not
controlled by the async thread and have the asyn thread check if the value
signifies abort. Perhaps a value available in Context, session or
application that the async thread can periodically look at.

Regards

John Timney (MVP)
http://www.johntimney.com
"Chip" <ch**@intradata.comwrote in message
news:%2****************@TK2MSFTNGP02.phx.gbl...
>I need to have an asynch thread abort itself. Something akin to a STOP. The
thread that spawned it cannot access it so it must done within the thread.

Chip

Sep 13 '06 #2
This approach has the parent process ending the thread. The test is in the
thread itself so it needed to be a self-abort. There doesn't seem to be a
good way to do it based on what I've been able to research, so since the
easy way out is not there, I restructured the code so I could just use "exit
sub".

Thanks for the reply,

Chip
"John Timney (MVP)" <x_****@timney.eclipse.co.ukwrote in message
news:IL********************@eclipse.net.uk...
Best way is probably to have a field visible to the thread thats not
controlled by the async thread and have the asyn thread check if the value
signifies abort. Perhaps a value available in Context, session or
application that the async thread can periodically look at.

Regards

John Timney (MVP)
http://www.johntimney.com
"Chip" <ch**@intradata.comwrote in message
news:%2****************@TK2MSFTNGP02.phx.gbl...
>>I need to have an asynch thread abort itself. Something akin to a STOP.
The thread that spawned it cannot access it so it must done within the
thread.

Chip


Sep 13 '06 #3
If you abort an asnc thread with something like thread abort I believe it
throws an unhandled exception, which can leave your objects in an ustable
state, hence my suggestion to use a controller value to terminate and exit
the thread cleanly. If you've managed to get it running to exit sub and die
cleanly then stick with it.

Regards

John Timney (MVP)
http://www.johntimney.com
"Chip" <ch**@intradata.comwrote in message
news:%2****************@TK2MSFTNGP04.phx.gbl...
This approach has the parent process ending the thread. The test is in the
thread itself so it needed to be a self-abort. There doesn't seem to be a
good way to do it based on what I've been able to research, so since the
easy way out is not there, I restructured the code so I could just use
"exit sub".

Thanks for the reply,

Chip
"John Timney (MVP)" <x_****@timney.eclipse.co.ukwrote in message
news:IL********************@eclipse.net.uk...
>Best way is probably to have a field visible to the thread thats not
controlled by the async thread and have the asyn thread check if the
value signifies abort. Perhaps a value available in Context, session or
application that the async thread can periodically look at.

Regards

John Timney (MVP)
http://www.johntimney.com
"Chip" <ch**@intradata.comwrote in message
news:%2****************@TK2MSFTNGP02.phx.gbl...
>>>I need to have an asynch thread abort itself. Something akin to a STOP.
The thread that spawned it cannot access it so it must done within the
thread.

Chip



Sep 13 '06 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

14 posts views Thread by Daisy | last post: by
7 posts views Thread by Morris | last post: by
20 posts views Thread by Doug Thews | last post: by
18 posts views Thread by Urs Vogel | last post: by
2 posts views Thread by Mark Denardo | last post: by
23 posts views Thread by Boltar | last post: by
5 posts views Thread by andrew | last post: by
6 posts views Thread by mehdi | last post: by
reply views Thread by gheharukoh7 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.