Explorar o código

Init GoMaxProcs op aantal cpu's voor go 1.4

Harry de Boer %!s(int64=10) %!d(string=hai) anos
pai
achega
021ccf61f3
Modificáronse 1 ficheiros con 2 adicións e 1 borrados
  1. 2 1
      boardserver/main.go

+ 2 - 1
boardserver/main.go

@@ -4,10 +4,11 @@ import (
 	"log"
 	"net/http"
 	"pinguin/board"
+	"runtime"
 )
 
 func main() {
-	//runtime.GOMAXPROCS(1)
+	runtime.GOMAXPROCS(runtime.NumCPU())
 	http.HandleFunc("/api/board", boardHandler)
 	http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
 		w.Write([]byte("Go battlecamp!"))