Before keeping on reading in the docs, my brain got stuck at this point:
- (void)threadMainRoutine {
BOOL moreWorkToDo = YES;
BOOL exitNow = NO;
NSRunLoop *runLoop = [NSRunLoop currentRunLoop]; // is this THE run loop?
// some stuff...
while (moreWorkToDo && !exitNow) { // or is THIS the run loop?
// some stuff
[runLoop runUntilDate:[NSDate date]];
// some stuff
}
// some stuff
}
I've added some comments in the code example. Maybe someone can explain this, why there's a while loop if there's a runLoop object that receives a -runUntilDate: message. I mean: Who is the loop here? I see two. First the while that's obviously a running loop, and then it calls a method that sounds like running a loop a well.
stateConfused = YES;
pleaseExplain = YES;