返回 DeepSeek-Reasonix
priority_other.go
根目录 / internal / proc / priority_other.go
1 //go:build !windows
2
3 package proc
4
5 import (
6 "os/exec"
7 "syscall"
8 )
9
10 // LowPriority is a no-op off Windows; unix sets niceness after start.
11 func LowPriority(*exec.Cmd) {}
12
13 // LowPriorityStarted renices a started command to below-normal priority,
14 // for background helpers (indexers) that must not starve the user's machine.
15 func LowPriorityStarted(cmd *exec.Cmd) {
16 if cmd.Process == nil {
17 return
18 }
19 _ = syscall.Setpriority(syscall.PRIO_PROCESS, cmd.Process.Pid, 10)
20 }
21
21 lines GO