1 Star 0 Fork 0

zhuchance / kubernetes

Create your Gitee Account
Explore and code with more than 12 million developers,Free private repositories !:)
Sign up
Clone or Download
process.go 439 Bytes
Copy Edit Raw Blame History
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
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Go
1
https://gitee.com/meoom/kubernetes.git
git@gitee.com:meoom/kubernetes.git
meoom
kubernetes
kubernetes
v0.18.0

Search

344bd9b3 5694891 D2dac590 5694891