954,510 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Threads

Hi,
how does one end a thread when it is done eg i have a program the when u press a button it starts a thread, this thread performs a set of instructions and then when it is done it it finished how do you end a thread then when the code is done, thus allowing the user to perform mulitple queries?
Thanks

CrazyProgrammer
Light Poster
29 posts since Oct 2009
Reputation Points: 10
Solved Threads: 0
 

Unless it's in an infinite loop, it ends when the method you used to start the thread is done.

Momerath
Nearly a Senior Poster
3,384 posts since Aug 2010
Reputation Points: 1,232
Solved Threads: 558
 

oh sweet
thanks thought that might be the case but wasn't sure

CrazyProgrammer
Light Poster
29 posts since Oct 2009
Reputation Points: 10
Solved Threads: 0
 

You should check out the. Net 4 Framework an the addition of Task. They did a really nice job with cancelling a threat orderly without the need for Abort.

The reason I say this is for long running queries, you have to wait until they finish before thread cleanup really happens. CancellationTokenResource, you have complete control to stop gracefully without raising an exception.

Venjense
Light Poster
31 posts since Oct 2003
Reputation Points: 13
Solved Threads: 5
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You
View similar articles that have also been tagged: