code: func NewStat() *Stat {
  	s := &Stat{}
  	runtime.SetFinalizer(s, (*Stat).free)
  
  	initDone := make(chan bool)
  	s.exitMessage = make(chan bool)
  
  	C.sg_init(1)
  
  	go func() {
  		// We need some function calls to be performed on the same thread
  		// Those for which statgrab is using a thread local
  		runtime.LockOSThread()
  		defer runtime.UnlockOSThread()
  
  		// Throw away the first reading as thats averaged over the machines uptime
  		C.sg_get_cpu_stats_diff(nil)
  		C.sg_get_network_io_stats_diff(nil)
  		C.sg_get_page_stats_diff(nil)
  		C.sg_get_disk_io_stats_diff(nil)
  
  		initDone <- true
  
  		for {
  			select {
  			case <-s.exitMessage:
  				return
  			case f := <-mainfunc:
  				f()
  			}
  		}
  
  	}()
  
  	<-initDone
  
  	return s
  }
docs: // NewStat return a new Stat handle