Running the Run Loop Until a Predicate Succeeds

Nicolas Bouilleaud: By observing kCFRunLoopBeforeWaiting, we can test for completion on every loop of the RunLoop. Before sleeping (i.e. waiting for an event), the RunLoop has called everything there was to call. That’s the right time to test for completion. This variant also solves the “active polling” scenarios: if the polling_ flag is set, the … Continue reading Running the Run Loop Until a Predicate Succeeds