I have an http server. This is written using Go. I have this code:
package main import ( "net/http" "runtime" ) var cur = 0 func handler(w http.ResponseWriter, r *http.Request) { cur = cur + 1; } func main() { runtime.GOMAXPROCS(runtime.NumCPU()) http.HandleFunc("/", handler) http.ListenAndServe(":9010", nil) }
It is safe? Maybe I need to use mutexes?
source share