So, I have a method that executes a loop and because of how my program works, I call this method using
[self performSelectorInBackground:@selector(myMethod:) withObject:arg]
And the method itself,
- (void)myMethod:(id)arg {
for (
if (stopMorse) {
break;
}
}
}
Now I would like to allow the user to stop starting this loop, so there is a way to kill / stop the thread.
I tried adding BOOL, but the problem is that it does not seem to be updated because it is in a separate thread. What is the best way to stop this loop from starting?
source
share