You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: numcpu_linux.go
    path of file: ./repos/moby/pkg/sysinfo
    
    the code of the file until where you have to start completion: package sysinfo // import "github.com/docker/docker/pkg/sysinfo"

import "golang.org/x/sys/unix"

// numCPU queries the system for the count of threads available
    
func numCPU() int {
	// Gets the affinity mask for a process: The very one invoking this function.
	var mask unix.CPUSet
	err := unix.SchedGetaffinity(0, &mask)
	if err != nil {
		return 0
	}
	return mask.Count()
}