Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1628)

Unified Diff: go/src/infra/libs/parallel/parallel.go

Issue 1153883002: go: infra/libs/* now live in luci-go. (Closed) Base URL: https://chromium.googlesource.com/infra/infra.git@master
Patch Set: move the rest too Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « go/src/infra/libs/logging/memlogger/memory_test.go ('k') | go/src/infra/libs/parallel/parallel_test.go » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: go/src/infra/libs/parallel/parallel.go
diff --git a/go/src/infra/libs/parallel/parallel.go b/go/src/infra/libs/parallel/parallel.go
deleted file mode 100644
index 6e2c87f6b95d81f7d5d363cb75e9aa12ab1fa0e8..0000000000000000000000000000000000000000
--- a/go/src/infra/libs/parallel/parallel.go
+++ /dev/null
@@ -1,46 +0,0 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-package parallel
-
-import (
- "sync"
-
- "infra/libs/errors"
-)
-
-// FanOutIn is useful to quickly parallelize a group of tasks.
-//
-// You pass it a function which is expected to push simple `func() error`
-// closures into the provided chan. Each function will be executed in parallel
-// and their error results will be collated.
-//
-// The function blocks until all functions are executed, and an
-// errors.MultiError is returned if one or more of your fan-out tasks failed,
-// otherwise this function returns nil.
-func FanOutIn(gen func(chan<- func() error)) error {
- funchan := make(chan func() error)
- go func() {
- defer close(funchan)
- gen(funchan)
- }()
-
- errchan := make(chan error)
- grp := sync.WaitGroup{}
- for fn := range funchan {
- grp.Add(1)
- fn := fn
- go func() {
- defer grp.Done()
- if err := fn(); err != nil {
- errchan <- err
- }
- }()
- }
- go func() {
- grp.Wait()
- close(errchan)
- }()
- return errors.MultiErrorFromErrors(errchan)
-}
« no previous file with comments | « go/src/infra/libs/logging/memlogger/memory_test.go ('k') | go/src/infra/libs/parallel/parallel_test.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698