Created
April 11, 2013 05:02
-
-
Save Bwooce/5360864 to your computer and use it in GitHub Desktop.
Use max cpu on any box
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"runtime" | |
"fmt" | |
) | |
func main() { | |
runtime.GOMAXPROCS(runtime.NumCPU()) | |
fmt.Println("Starting to use cpu on", runtime.NumCPU(), "cores") | |
for i:=0;i<runtime.NumCPU()-1;i++ { | |
go forever() | |
} | |
for { } | |
} | |
func forever() { | |
for { } | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment