2016-12-01 21:06:19 -08:00
|
|
|
/*----------------------------------------------------------------------------*/
|
2018-01-02 09:20:21 -08:00
|
|
|
/* Copyright (c) 2016-2018 FIRST. All Rights Reserved. */
|
2016-12-01 21:06:19 -08:00
|
|
|
/* Open Source Software - may be modified and shared by FRC teams. The code */
|
|
|
|
|
/* must be accompanied by the FIRST BSD license file in the root directory of */
|
|
|
|
|
/* the project. */
|
|
|
|
|
/*----------------------------------------------------------------------------*/
|
|
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
#include <thread>
|
|
|
|
|
|
|
|
|
|
namespace frc {
|
|
|
|
|
|
2018-05-31 20:47:15 -07:00
|
|
|
/**
|
|
|
|
|
* Get the thread priority for the specified thread.
|
|
|
|
|
*
|
|
|
|
|
* @param thread Reference to the thread to get the priority for.
|
|
|
|
|
* @param isRealTime Set to true if thread is realtime, otherwise false.
|
|
|
|
|
* @return The current thread priority. Scaled 1-99, with 1 being highest.
|
|
|
|
|
*/
|
2016-12-01 21:06:19 -08:00
|
|
|
int GetThreadPriority(std::thread& thread, bool* isRealTime);
|
2018-05-31 20:47:15 -07:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Get the thread priority for the current thread
|
|
|
|
|
*
|
|
|
|
|
* @param isRealTime Set to true if thread is realtime, otherwise false.
|
|
|
|
|
* @return The current thread priority. Scaled 1-99.
|
|
|
|
|
*/
|
2016-12-01 21:06:19 -08:00
|
|
|
int GetCurrentThreadPriority(bool* isRealTime);
|
2018-05-31 20:47:15 -07:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Sets the thread priority for the specified thread
|
|
|
|
|
*
|
|
|
|
|
* @param thread Reference to the thread to set the priority of.
|
|
|
|
|
* @param realTime Set to true to set a realtime priority, false for standard
|
|
|
|
|
* priority.
|
|
|
|
|
* @param priority Priority to set the thread to. Scaled 1-99, with 1 being
|
|
|
|
|
* highest. On RoboRIO, priority is ignored for non realtime
|
|
|
|
|
* setting.
|
|
|
|
|
*
|
|
|
|
|
* @return The success state of setting the priority
|
|
|
|
|
*/
|
2016-12-01 21:06:19 -08:00
|
|
|
bool SetThreadPriority(std::thread& thread, bool realTime, int priority);
|
2018-05-31 20:47:15 -07:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Sets the thread priority for the current thread
|
|
|
|
|
*
|
|
|
|
|
* @param realTime Set to true to set a realtime priority, false for standard
|
|
|
|
|
* priority.
|
|
|
|
|
* @param priority Priority to set the thread to. Scaled 1-99, with 1 being
|
|
|
|
|
* highest. On RoboRIO, priority is ignored for non realtime
|
|
|
|
|
* setting.
|
|
|
|
|
*
|
|
|
|
|
* @return The success state of setting the priority
|
|
|
|
|
*/
|
2016-12-01 21:06:19 -08:00
|
|
|
bool SetCurrentThreadPriority(bool realTime, int priority);
|
2017-08-23 22:07:46 -07:00
|
|
|
|
2016-12-01 21:06:19 -08:00
|
|
|
} // namespace frc
|