In my main function for my command line program, I create a new instance of an NSThread
subclass, and call start
on it, where it runs a timer in a different thread. If the user wants to stop the timer, they type "stop" and I want it to end the thread as well.
How would I go about doing this? I'm gathering that I should call cancel
on the thread, then in the main
of the NSThread
subclass check if isCancelled
is YES
, but as far as I know main is only called when I call start
initially. I don't see where else I could check isCancelled
in order to call [NSThread exit]
.
How should I handle exiting this NSThread?