Fix RT priority docs (NFC) (#3098)

The ranges and which value was specified as highest were incorrect on
some of them. On Linux, the range is 1 to 99 with 99 being highest.

From `man 7 sched`:
```
Processes scheduled under one of the real-time policies (SCHED_FIFO,
SCHED_RR) have a sched_priority value in the range 1 (low) to 99 (high).
```

Also clean up the relevant javadoc and doxygen comments.
This commit is contained in:
Tyler Veness
2021-01-19 22:59:18 -08:00
committed by GitHub
parent b3426e9c0d
commit 6b1898f12e
6 changed files with 60 additions and 51 deletions

View File

@@ -10,16 +10,17 @@ public final class Threads {
/**
* Get the thread priority for the current thread.
*
* @return The current thread priority. Scaled 1-99.
* @return The current thread priority. For real-time, this is 1-99 with 99 being highest. For
* non-real-time, this is 0. See "man 7 sched" for details.
*/
public static int getCurrentThreadPriority() {
return ThreadsJNI.getCurrentThreadPriority();
}
/**
* Get if the current thread is realtime.
* Get if the current thread is real-time.
*
* @return If the current thread is realtime
* @return If the current thread is real-time.
*/
public static boolean getCurrentThreadIsRealTime() {
return ThreadsJNI.getCurrentThreadIsRealTime();
@@ -28,10 +29,10 @@ public final class Threads {
/**
* 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
* @param realTime Set to true to set a real-time priority, false for standard priority.
* @param priority Priority to set the thread to. For real-time, this is 1-99 with 99 being
* highest. For non-real-time, this is forced to 0. See "man 7 sched" for details.
* @return True on success.
*/
public static boolean setCurrentThreadPriority(boolean realTime, int priority) {
return ThreadsJNI.setCurrentThreadPriority(realTime, priority);