提交 913a733e 作者: Juan Batiz-Benet

helpful panics

上级 0552f46f
...@@ -197,7 +197,7 @@ ...@@ -197,7 +197,7 @@
}, },
{ {
"ImportPath": "github.com/jbenet/goprocess", "ImportPath": "github.com/jbenet/goprocess",
"Rev": "c5455a611a9e0cebac87e7ae421c3273c3224000" "Rev": "060ad098994e6adac22f0bd889eb756d4f5ad35b"
}, },
{ {
"ImportPath": "github.com/kr/binarydist", "ImportPath": "github.com/kr/binarydist",
......
...@@ -35,6 +35,10 @@ func newProcess(tf TeardownFunc) *process { ...@@ -35,6 +35,10 @@ func newProcess(tf TeardownFunc) *process {
} }
func (p *process) WaitFor(q Process) { func (p *process) WaitFor(q Process) {
if q == nil {
panic("waiting for nil process")
}
p.Lock() p.Lock()
select { select {
...@@ -48,6 +52,10 @@ func (p *process) WaitFor(q Process) { ...@@ -48,6 +52,10 @@ func (p *process) WaitFor(q Process) {
} }
func (p *process) AddChildNoWait(child Process) { func (p *process) AddChildNoWait(child Process) {
if child == nil {
panic("adding nil child process")
}
p.Lock() p.Lock()
select { select {
...@@ -61,6 +69,10 @@ func (p *process) AddChildNoWait(child Process) { ...@@ -61,6 +69,10 @@ func (p *process) AddChildNoWait(child Process) {
} }
func (p *process) AddChild(child Process) { func (p *process) AddChild(child Process) {
if child == nil {
panic("adding nil child process")
}
p.Lock() p.Lock()
select { select {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论