Reputation:
how to exit thread while its in running mode...when i use NSThread exit my app get hanged... Can any one help me ? what could i use here to exit thread or close thread
Thanks Its my first post here.
Upvotes: 1
Views: 1788
Reputation: 1527
I assume you're looking for a way to cancel a thread once you've started it. It's all in the set up. Here's an example:
(
void) doCalculation{ /* Do your calculation here */ }
In this example, the loop is conditioned on the thread being in a non-cancelled state.
Upvotes: 0
Reputation: 299345
The routine you're looking for is return
.
The thread will terminate when the function that you launched it with finishes. You don't need to terminate the NSThread; it will handle that itself. You just need to return from the function call.
Upvotes: 6