
godep restore pushd $GOPATH/src/github.com/appc/spec git co master popd go get go4.org/errorutil rm -rf Godeps godep save ./... git add vendor git add -f $(git ls-files --other vendor/) git co -- Godeps/LICENSES Godeps/.license_file_state Godeps/OWNERS
35 lines
439 B
Go
35 lines
439 B
Go
package process
|
|
|
|
import (
|
|
"fmt"
|
|
"sync"
|
|
)
|
|
|
|
var (
|
|
pidLock sync.Mutex
|
|
pid uint64
|
|
)
|
|
|
|
func nextPid() uint64 {
|
|
pidLock.Lock()
|
|
defer pidLock.Unlock()
|
|
pid++
|
|
return pid
|
|
}
|
|
|
|
//TODO(jdef) add lifecycle funcs
|
|
//TODO(jdef) add messaging funcs
|
|
type Process struct {
|
|
label string
|
|
}
|
|
|
|
func New(kind string) *Process {
|
|
return &Process{
|
|
label: fmt.Sprintf("%s(%d)", kind, nextPid()),
|
|
}
|
|
}
|
|
|
|
func (p *Process) Label() string {
|
|
return p.label
|
|
}
|