[cscore] Change run loop functions to not be mac specific (#4854)

This commit is contained in:
Thad House
2022-12-25 11:37:59 -08:00
committed by GitHub
parent 1f940e2b60
commit 1e7fcd5637
6 changed files with 87 additions and 28 deletions

View File

@@ -5,17 +5,26 @@
#include "cscore_runloop.h"
#include <CoreFoundation/CFRunLoop.h>
#import <Foundation/Foundation.h>
namespace cs {
void RunOsxRunLoop() {
void RunMainRunLoop() {
if (CFRunLoopGetMain() != CFRunLoopGetCurrent()) {
NSLog(@"This method can only be called from the main thread");
return;
}
CFRunLoopRun();
}
int RunOsxRunLoopTimeout(double timeoutSeconds) {
int RunMainRunLoopTimeout(double timeoutSeconds) {
if (CFRunLoopGetMain() != CFRunLoopGetCurrent()) {
NSLog(@"This method can only be called from the main thread");
return -1;
}
return CFRunLoopRunInMode(kCFRunLoopDefaultMode, timeoutSeconds, false);
}
void StopOsxMainRunLoop() {
void StopMainRunLoop() {
CFRunLoopStop(CFRunLoopGetMain());
}
}