1
0
Fork 0

Remove tools

This commit is contained in:
Gregory Eremin 2015-02-10 02:47:52 +07:00
parent 5d41d0f85f
commit fb5cc85375
2 changed files with 17 additions and 22 deletions

View File

@ -123,3 +123,20 @@ func readChains() map[string]interface{} {
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
}
}
}

View File

@ -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
}
}
}