Skip to content

nice, Windows: support mapping current Priority Class #14484

Description

@oech3

While setting Priority Class is supported and Priority Class is mapped like

#[cfg(windows)]
let priority_class = match new_niceness {
..=-20 => REALTIME_PRIORITY_CLASS,
-19 => HIGH_PRIORITY_CLASS,
-18..=-1 => ABOVE_NORMAL_PRIORITY_CLASS,
0 => NORMAL_PRIORITY_CLASS,
1..=18 => BELOW_NORMAL_PRIORITY_CLASS,
19.. => IDLE_PRIORITY_CLASS,
};

. showing (mapping) current Priority Class is not supported:
#[cfg(not(unix))]
let current_niceness = 0i32; // todo: what we can do?

It would be better to be compatible with Cygwin's nice command.
Also, nice should show raw Priority Class e.g. instead of value if it is not a mapped class.
ref: https://learn.microsoft.com/en-us/windows/win32/api/processthreadsapi/nf-processthreadsapi-setpriorityclass

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions