I have worker thread task that published results on main queue using:
// on worker queue
// (long-running task)
// publish results on main queue
dispatch_async(dispatch_get_main_queue(), ^(void) {
_finished = YES;
});
How can i sit in main queue (main CXTest thread) and force gcd handle current tasks on the queue like:
// on main queue
while (!_finished) {
[NSThread sleepForTimeInterval:0.1];
// TODO : force main queue to perform current blocks
}
The obvious solution is to set _finished in worker thread, but i can't do that for some reason (UI controls can be touched in main thread only)
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…