mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-19 00:41:43 +00:00
Add ability to run robot main loop in a separate thread (#1895)
Default behavior is still to run the robot main loop in the main thread. The ability to run the robot main loop in a separate thread and add a hook for running a different function in the main thread is needed for simulation GUI support on some platforms.
This commit is contained in:
@@ -17,6 +17,7 @@
|
||||
#include "HALUtil.h"
|
||||
#include "edu_wpi_first_hal_HAL.h"
|
||||
#include "hal/DriverStation.h"
|
||||
#include "hal/Main.h"
|
||||
|
||||
using namespace frc;
|
||||
using namespace wpi::java;
|
||||
@@ -35,6 +36,42 @@ Java_edu_wpi_first_hal_HAL_initialize
|
||||
return HAL_Initialize(timeout, mode);
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: edu_wpi_first_hal_HAL
|
||||
* Method: hasMain
|
||||
* Signature: ()Z
|
||||
*/
|
||||
JNIEXPORT jboolean JNICALL
|
||||
Java_edu_wpi_first_hal_HAL_hasMain
|
||||
(JNIEnv*, jclass)
|
||||
{
|
||||
return HAL_HasMain();
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: edu_wpi_first_hal_HAL
|
||||
* Method: runMain
|
||||
* Signature: ()V
|
||||
*/
|
||||
JNIEXPORT void JNICALL
|
||||
Java_edu_wpi_first_hal_HAL_runMain
|
||||
(JNIEnv*, jclass)
|
||||
{
|
||||
HAL_RunMain();
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: edu_wpi_first_hal_HAL
|
||||
* Method: exitMain
|
||||
* Signature: ()V
|
||||
*/
|
||||
JNIEXPORT void JNICALL
|
||||
Java_edu_wpi_first_hal_HAL_exitMain
|
||||
(JNIEnv*, jclass)
|
||||
{
|
||||
HAL_ExitMain();
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: edu_wpi_first_hal_HAL
|
||||
* Method: observeUserProgramStarting
|
||||
|
||||
Reference in New Issue
Block a user