Chromium Code Reviews| Index: build/android/devil/utils/reraiser_thread.py |
| diff --git a/build/android/devil/utils/reraiser_thread.py b/build/android/devil/utils/reraiser_thread.py |
| index e108fc754fbe9befd62c25dfe1e68f97ef071161..5181ccb356e6a25df1e173c0313eb0a85516598b 100644 |
| --- a/build/android/devil/utils/reraiser_thread.py |
| +++ b/build/android/devil/utils/reraiser_thread.py |
| @@ -213,16 +213,25 @@ def CurrentThreadGroup(): |
| return None |
| -def RunAsync(funcs, watcher=None): |
| +def RunAsync(funcs, args=None, kwargs=None, watcher=None, names=None): |
| """Executes the given functions in parallel and returns their results. |
| Args: |
| funcs: List of functions to perform on their own threads. |
| + args: List of list of args to be passed to the corresponding func. |
| + kwargs: List of dicts of kwargs to be passed to the corresponding func. |
| watcher: Watchdog object providing timeout, by default waits forever. |
| + names: List of names for the threads. |
| Returns: |
| A list of return values in the order of the given functions. |
| """ |
| - thread_group = ReraiserThreadGroup(ReraiserThread(f) for f in funcs) |
| + args = args or [None]*len(funcs) |
|
jbudorick
2015/12/01 04:07:13
where's the linter when I need it... spaces around
|
| + kwargs = kwargs or [None]*len(funcs) |
| + names = names or [None]*len(funcs) |
| + |
| + thread_group = ReraiserThreadGroup( |
| + ReraiserThread(f, args=a, kwargs=k, name=n) |
|
jbudorick
2015/12/01 04:07:13
Adding these probably means you're abusing RunAsyn
|
| + for (f, a, k, n) in zip(funcs, args, kwargs, names)) |
| thread_group.StartAll(will_block=True) |
| return thread_group.GetAllReturnValues(watcher=watcher) |