Skip to content

Commit 854af27

Browse files
atetuboualexbrainman
authored andcommitted
windows: add functions for priority class
took const value from https://docs.microsoft.com/en-us/windows/desktop/api/processthreadsapi/nf-processthreadsapi-setpriorityclass https://docs.microsoft.com/en-us/windows/desktop/api/processthreadsapi/nf-processthreadsapi-getpriorityclass Change-Id: I376bb8e1f5de8968177512857d60169cb7b7c776 Reviewed-on: https://go-review.googlesource.com/c/sys/+/179038 Reviewed-by: Alex Brainman <[email protected]> Run-TryBot: Alex Brainman <[email protected]> TryBot-Result: Gobot Gobot <[email protected]>
1 parent 3626398 commit 854af27

File tree

3 files changed

+41
-0
lines changed

3 files changed

+41
-0
lines changed

windows/syscall_windows.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -258,6 +258,8 @@ func NewCallbackCDecl(fn interface{}) uintptr {
258258
//sys TerminateJobObject(job Handle, exitCode uint32) (err error) = kernel32.TerminateJobObject
259259
//sys SetErrorMode(mode uint32) (ret uint32) = kernel32.SetErrorMode
260260
//sys ResumeThread(thread Handle) (ret uint32, err error) [failretval==0xffffffff] = kernel32.ResumeThread
261+
//sys SetPriorityClass(process Handle, priorityClass uint32) (err error) = kernel32.SetPriorityClass
262+
//sys GetPriorityClass(process Handle) (ret uint32, err error) = kernel32.GetPriorityClass
261263

262264
// Volume Management Functions
263265
//sys DefineDosDevice(flags uint32, deviceName *uint16, targetPath *uint16) (err error) = DefineDosDeviceW

windows/types_windows.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -408,6 +408,18 @@ const (
408408
SEM_NOOPENFILEERRORBOX = 0x8000
409409
)
410410

411+
const (
412+
// Priority class.
413+
ABOVE_NORMAL_PRIORITY_CLASS = 0x00008000
414+
BELOW_NORMAL_PRIORITY_CLASS = 0x00004000
415+
HIGH_PRIORITY_CLASS = 0x00000080
416+
IDLE_PRIORITY_CLASS = 0x00000040
417+
NORMAL_PRIORITY_CLASS = 0x00000020
418+
PROCESS_MODE_BACKGROUND_BEGIN = 0x00100000
419+
PROCESS_MODE_BACKGROUND_END = 0x00200000
420+
REALTIME_PRIORITY_CLASS = 0x00000100
421+
)
422+
411423
var (
412424
OID_PKIX_KP_SERVER_AUTH = []byte("1.3.6.1.5.5.7.3.1\x00")
413425
OID_SERVER_GATED_CRYPTO = []byte("1.3.6.1.4.1.311.10.3.3\x00")

windows/zsyscall_windows.go

Lines changed: 27 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)