WPILibC++ 2027.0.0-alpha-5
Loading...
Searching...
No Matches
Threads.hpp
Go to the documentation of this file.
1// Copyright (c) FIRST and other WPILib contributors.
2// Open Source Software; you can modify and/or share it under the terms of
3// the WPILib BSD license file in the root directory of this project.
4
5#pragma once
6
7#include <thread>
8
9namespace wpi {
10
11/**
12 * Gets the specified thread's priority.
13 *
14 * Priorities range from 0 to 99 where 0 is non-real-time, 1-99 are real-time,
15 * and 99 is highest priority. See "man 7 sched" for details.
16 *
17 * @param thread The thread.
18 * @return The specified thread's priority.
19 */
20int GetThreadPriority(std::thread& thread);
21
22/**
23 * Gets the current thread's priority.
24 *
25 * Priorities range from 0 to 99 where 0 is non-real-time, 1-99 are real-time,
26 * and 99 is highest priority. See "man 7 sched" for details.
27 *
28 * @return The current thread's priority.
29 */
31
32/**
33 * Sets the specified thread's priority.
34 *
35 * Priorities range from 0 to 99 where 0 is non-real-time, 1-99 are real-time,
36 * and 99 is highest priority. See "man 7 sched" for details.
37 *
38 * @param thread The thread.
39 * @param priority The priority.
40 * @return True on success.
41 * @deprecated Incorrect usage of real-time priority can lead to system lockups.
42 * Only use this function if you are trained in real-time software
43 * development.
44 */
45[[deprecated(
46 "Incorrect usage of real-time priority can lead to system lockups. Only "
47 "use this function if you are trained in real-time software development.")]]
48bool SetThreadPriority(std::thread& thread, int priority);
49
50/**
51 * Sets the current thread's priority.
52 *
53 * Priorities range from 0 to 99 where 0 is non-real-time, 1-99 are real-time,
54 * and 99 is highest priority. See "man 7 sched" for details.
55 *
56 * @param priority The priority.
57 * @return True on success.
58 * @deprecated Incorrect usage of real-time priority can lead to system lockups.
59 * Only use this function if you are trained in real-time software
60 * development.
61 */
62[[deprecated(
63 "Incorrect usage of real-time priority can lead to system lockups. Only "
64 "use this function if you are trained in real-time software development.")]]
65bool SetCurrentThreadPriority(int priority);
66
67} // namespace wpi
Definition CvSource.hpp:15
int GetThreadPriority(std::thread &thread)
Gets the specified thread's priority.
bool SetThreadPriority(std::thread &thread, int priority)
Sets the specified thread's priority.
bool SetCurrentThreadPriority(int priority)
Sets the current thread's priority.
int GetCurrentThreadPriority()
Gets the current thread's priority.