I have a method (let’s call it run):
- (void)run
{
// Do some initialisation
// Loop until another thread signals it to exit
while (SHOULD_STILL_LOOP) { ... }
// Clean up code
}
And I call it with:
[self performSelectorInBackground:@selector(run)];
What is the best way to implement SHOULD_STILL_LOOP? Should I use an atomic property, a NSCondition, dispatch semaphore?
Perhaps some stackies can offer me some advice?
Thanks.
I have found one way of doing this and that is using NSThread.