返回 DeepSeek-Reasonix
priority_windows.go
根目录 / internal / proc / priority_windows.go
1 //go:build windows
2
3 package proc
4
5 import (
6 "os/exec"
7 "syscall"
8 )
9
10 const belowNormalPriorityClass = 0x00004000 // BELOW_NORMAL_PRIORITY_CLASS
11
12 // LowPriority marks a not-yet-started command to run below normal priority,
13 // for background helpers (indexers) that must not starve the user's machine.
14 func LowPriority(cmd *exec.Cmd) {
15 if cmd.SysProcAttr == nil {
16 cmd.SysProcAttr = &syscall.SysProcAttr{}
17 }
18 cmd.SysProcAttr.CreationFlags |= belowNormalPriorityClass
19 }
20
21 // LowPriorityStarted is a no-op on Windows; priority is set at creation.
22 func LowPriorityStarted(*exec.Cmd) {}
23
23 lines GO