-[deviceInquiryComplete:error:aborted:] comes in on the main thread in macOS 10.13, so instead of using CFRunLoopRun()/CFRunLoopStop(), just let the run loop do one pass. This is already in a loop waiting for done to be false. This also means -[deviceInquiryComplete:error:aborted:] should no longer call CFRunLoopStop(). Fixes connecting to Wiimotes in macOS 10.13+, should continue to work as before in 10.12 and below.

This commit is contained in:
Andrew Molloy 2017-12-03 10:32:07 -05:00
parent 8bcc392d5d
commit d306397bbc

View File

@ -54,7 +54,7 @@ void WiimoteScannerDarwin::FindWiimotes(std::vector<Wiimote*>& found_wiimotes,
do
{
CFRunLoopRun();
CFRunLoopRunInMode(kCFRunLoopDefaultMode, 0, false);
} while (!sbt->done);
int found_devices = [[bti foundDevices] count];
@ -255,7 +255,6 @@ void WiimoteDarwin::DisablePowerAssertionInternal()
aborted:(BOOL)aborted
{
done = true;
CFRunLoopStop(CFRunLoopGetCurrent());
}
- (void)deviceInquiryDeviceFound:(IOBluetoothDeviceInquiry*)sender device:(IOBluetoothDevice*)device