I have NSOperationQueue
with some NSOperations
in it (NSInvocationOperations
, in particular). This operations do some calculations and change states of UI elements accordingly (of course, via performSelectorOnMainThread:...
), often with use of animations.
My UI has UINavigationViewController and some buttons for navigation to another views. So user can leave current view, while calculations / animations are still in progress. And what I need is to stop this somehow until user comes back to current view.
The only solution I found is to create some thread-safe boolean flag - and to check it in all threads (something like: while !flag sleep_for_some_time;). Is there something better?