impl-mutex.go
func (p *process) Close() error {
	p.Lock()

	// if already closing, or closed, get out. (but wait!)
	select {
	case <-p.Closing():
		p.Unlock()
		<-p.Closed()
		return p.closeErr
	default:
	}

	p.doClose()
	p.Unlock()
	return p.closeErr
}
func (p *process) Close() error {
	p.Lock()

	// if already closing, or closed, get out. (but wait!)
	select {
	case <-p.Closing():
		p.Unlock()
		<-p.Closed()
		return p.closeErr
	default:
	}

	p.doClose()
	p.Unlock()
	return p.closeErr
}
func ( p * process ) Close ( ) error { p . Lock ( ) // if already closing, or closed, get out. (but wait!) select { case <- p . Closing ( ) : p . Unlock ( ) <- p . Closed ( ) return p . closeErr default : } p . doClose ( ) p . Unlock ( ) return p . closeErr }
// Close is the external close function.
// it's a wrapper around internalClose that waits on Closed()
Close is the external close function . it s a wrapper around internalClose that waits on Closed ()