Remove tools
This commit is contained in:
parent
5d41d0f85f
commit
fb5cc85375
|
@ -123,3 +123,20 @@ func readChains() map[string]interface{} {
|
||||||
|
|
||||||
return chains
|
return chains
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func SyncronizeParallelChain(ctx context.Context, fn func(context.Context)) {
|
||||||
|
var (
|
||||||
|
pcontexts = ctx.Value("parallel_contexts").(chan context.Context)
|
||||||
|
pfinished = ctx.Value("parallel_finished").(chan struct{})
|
||||||
|
working = true
|
||||||
|
)
|
||||||
|
|
||||||
|
for len(pcontexts) > 0 || working {
|
||||||
|
select {
|
||||||
|
case pctx := <-pcontexts:
|
||||||
|
fn(pctx)
|
||||||
|
case <-pfinished:
|
||||||
|
working = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -1,22 +0,0 @@
|
||||||
package tools
|
|
||||||
|
|
||||||
import (
|
|
||||||
"code.google.com/p/go.net/context"
|
|
||||||
)
|
|
||||||
|
|
||||||
func SyncronizeParallelChain(ctx context.Context, fn func(context.Context)) {
|
|
||||||
var (
|
|
||||||
pcontexts = ctx.Value("parallel_contexts").(chan context.Context)
|
|
||||||
pfinished = ctx.Value("parallel_finished").(chan struct{})
|
|
||||||
working = true
|
|
||||||
)
|
|
||||||
|
|
||||||
for len(pcontexts) > 0 || working {
|
|
||||||
select {
|
|
||||||
case pctx := <-pcontexts:
|
|
||||||
fn(pctx)
|
|
||||||
case <-pfinished:
|
|
||||||
working = false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Reference in New Issue