Help us shape the future of Go! Take the 2026 Go Developer Survey

cpuaffinity

package module
v0.0.0-...-c2ac5cb Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 26, 2020 License: MIT Imports: 2 Imported by: 1

README

go-cpuaffinity

read godoc for usage

On windows, gcc(mingw, msys2 or cygwin) is required

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 {}
}

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL