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

Side by Side Diff: common/parallel/parallel.go

Issue 1610993002: LogDog: Add collector service implementation. (Closed) Base URL: https://github.com/luci/luci-go@master
Patch Set: Created 4 years, 11 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 unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 package parallel 5 package parallel
6 6
7 // FanOutIn is useful to quickly parallelize a group of tasks. 7 // FanOutIn is useful to quickly parallelize a group of tasks.
8 // 8 //
9 // You pass it a function which is expected to push simple `func() error` 9 // You pass it a function which is expected to push simple `func() error`
10 // closures into the provided chan. Each function will be executed in parallel 10 // closures into the provided chan. Each function will be executed in parallel
11 // and their error results will be collated. 11 // and their error results will be collated.
12 // 12 //
13 // The function blocks until all functions are executed, and an 13 // The function blocks until all functions are executed, and an
14 // errors.MultiError is returned if one or more of your fan-out tasks failed, 14 // errors.MultiError is returned if one or more of your fan-out tasks failed,
15 // otherwise this function returns nil. 15 // otherwise this function returns nil.
16 // 16 //
17 // This function is equivalent to WorkPool(0, gen). 17 // This function is equivalent to WorkPool(0, gen).
18 func FanOutIn(gen func(chan<- func() error)) error { 18 func FanOutIn(gen func(chan<- func() error)) error {
19 » return WorkPool(0, gen) 19 » return Run(nil, gen)
dnj (Google) 2016/01/21 04:36:24 Run is one WorkPool, but more baremetal.
20 } 20 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698