Skip to content

Instantly share code, notes, and snippets.

View zhenjl's full-sized avatar

Jian Zhen zhenjl

View GitHub Profile
// First: go get github.com/golang/glog
// Then : go test -v -vmodule=*=3 -logtostderr netgrace_test.go
// This test package shows how to gracefully shutdown a net.Listener.
package netgrace
import (
"bufio"
"fmt"
"github.com/golang/glog"
@zhenjl
zhenjl / mutexvscas.go
Last active August 29, 2015 14:02
A quick test of mutex vs CAS, using 1 or more goroutines and 1 or more CPU cores
// Results are in
// https://docs.google.com/spreadsheets/d/1R-KVBfKxM3KL2G4AuPtxr4SS_1iQYfrPTo0r5EZOFXs/pubhtml
package mutexvscas
import (
"testing"
"sync"
"log"
"time"