mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-19 00:41:43 +00:00
[cscore] Change run loop functions to not be mac specific (#4854)
This commit is contained in:
@@ -2,12 +2,37 @@
|
||||
// Open Source Software; you can modify and/or share it under the terms of
|
||||
// the WPILib BSD license file in the root directory of this project.
|
||||
|
||||
#include <wpi/Synchronization.h>
|
||||
|
||||
#include "cscore_runloop.h"
|
||||
|
||||
namespace cs {
|
||||
void RunOsxRunLoop() {}
|
||||
int RunOsxRunLoopTimeout(double timeoutSeconds) {
|
||||
return 0;
|
||||
static wpi::Event& GetInstance() {
|
||||
static wpi::Event event;
|
||||
return event;
|
||||
}
|
||||
|
||||
namespace cs {
|
||||
void RunMainRunLoop() {
|
||||
wpi::Event& event = GetInstance();
|
||||
wpi::WaitForObject(event.GetHandle());
|
||||
}
|
||||
|
||||
int RunMainRunLoopTimeout(double timeoutSeconds) {
|
||||
wpi::Event& event = GetInstance();
|
||||
bool timedOut = false;
|
||||
bool signaled =
|
||||
wpi::WaitForObject(event.GetHandle(), timeoutSeconds, &timedOut);
|
||||
if (timedOut) {
|
||||
return 3;
|
||||
}
|
||||
if (signaled) {
|
||||
return 2;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
void StopMainRunLoop() {
|
||||
wpi::Event& event = GetInstance();
|
||||
event.Set();
|
||||
}
|
||||
void StopOsxMainRunLoop() {}
|
||||
} // namespace cs
|
||||
|
||||
Reference in New Issue
Block a user