mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-20 00:51:42 +00:00
[cscore] Change run loop functions to not be mac specific (#4854)
This commit is contained in:
@@ -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());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user