Documentation
¶
Overview ¶
Example ¶
package main
import (
"crypto/sha256"
"github.com/maoxs2/go-cpuaffinity"
)
func main() {
go func() {
cpuaffinity.SetCPUAffinity(0)
for {
sha256.Sum256(nil)
}
}()
go func() {
cpuaffinity.SetCPUAffinity(2)
for {
sha256.Sum256(nil)
}
}()
go func() {
cpuaffinity.SetCPUAffinity(3)
for {
sha256.Sum256(nil)
}
}()
select {}
}
Output:
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SetCPUAffinity ¶
func SetCPUAffinity(cpuID int)
SetCPUAffinity locks the goroutine to the thread and then locks the thread to the CPU
func SetCPUAffinityMask ¶
func SetCPUAffinityMask(mask uint64)
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.