Kaynağa Gözat

Init GoMaxProcs op aantal cpu's voor go 1.4

Harry de Boer 10 yıl önce
ebeveyn
işleme
021ccf61f3
1 değiştirilmiş dosya ile 2 ekleme ve 1 silme
  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!"))