Adding dep files and dependencies.

This commit is contained in:
Renan DelValle 2018-09-30 18:02:42 -07:00
parent 45f9efa578
commit b341c0a0e4
No known key found for this signature in database
GPG key ID: 3895800E03F17676
539 changed files with 313111 additions and 0 deletions

View file

@ -0,0 +1,34 @@
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
}