You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -213,8 +215,26 @@ to set it to [`WinAPIThreadPriority::Idle`] when it is really needed.
213
215
)]
214
216
Min,
215
217
/// Holds a platform-independent priority value.
216
-
/// Usually used when setting a value, for sometimes it is not possible to map
217
-
/// the operating system's priority to this value.
218
+
#[cfg_attr(
219
+
not(target_os = "windows"),
220
+
doc = "\
221
+
The value is used in two ways when the underlying OS is POSIX-compatible.
222
+
# When setting the priority value
223
+
224
+
- When a scheduling policy other than real-time is used, the value is mapped to the range
225
+
of niceness values, typically ranging from -20 to 19 inclusively, so that the [`ThreadPriority::Min`] would mean the
226
+
minimum possible value of niceness (19), the [`ThreadPriority::Max`] the maximum value (-20) and the
227
+
[`ThreadPriority::Crossplatform`] variant would be mapped from its range of values (from [`ThreadPriorityValue::MIN`]
228
+
to [`ThreadPriorityValue::MAX`]) to the range of [`crate::unix::NICENESS_MIN`] till [`crate::unix::NICENESS_MAX`]).
229
+
- When a scheduling policy is the one of the real-time ones, the value is then converted to the range of possible values
230
+
for a real-time thread of the specified real-time scheduling policy, being an argument [`libc::sched_param::sched_priority`].
231
+
232
+
# When obtaining the priority value
233
+
234
+
- When the scheduling policy is not real-time, the niceness-converted value is returned after mapping to the range of possible values for the [`ThreadPriorityValue`] type ([`ThreadPriorityValue::RANGE`]).
235
+
- When the scheduling policy is real-time, the [`libc::sched_param::sched_priority`] value is converted to the range of possible values for the [`ThreadPriorityValue`] type ([`ThreadPriorityValue::RANGE`]).
236
+
"
237
+
)]
218
238
Crossplatform(ThreadPriorityValue),
219
239
/// Holds an operating system specific value. If it is not possible to obtain the
220
240
/// [`ThreadPriority::Crossplatform`] variant of the value, this is returned instead.
0 commit comments