Index: example/runner-pool.dart |
diff --git a/example/runner-pool.dart b/example/runner-pool.dart |
index e81e496050ee2f88fba6a04e61f8b02d6900ab82..e4d7b311d421715808fc7edd99cfd86f5d7daf83 100644 |
--- a/example/runner-pool.dart |
+++ b/example/runner-pool.dart |
@@ -8,7 +8,6 @@ import "package:isolate/loadbalancer.dart"; |
import "package:isolate/isolaterunner.dart"; |
import "dart:async" show Future, Completer; |
- |
void main() { |
int N = 44; |
var sw = new Stopwatch()..start(); |
@@ -30,21 +29,22 @@ void main() { |
// Compute fibonnacci 1..limit |
Future<List<int>> parfib(int limit, int parallelity) { |
- return LoadBalancer.create(parallelity, IsolateRunner.spawn).then( |
- (LoadBalancer pool) { |
- List<Future> fibs = new List(limit + 1); |
- // Schedule all calls with exact load value and the heaviest task |
- // assigned first. |
- schedule(a, b, i) { |
- if (i < limit) { |
- schedule(a + b, a, i + 1); |
- } |
- fibs[i] = pool.run(fib, i, load: a); |
+ return LoadBalancer |
+ .create(parallelity, IsolateRunner.spawn) |
+ .then((LoadBalancer pool) { |
+ List<Future> fibs = new List(limit + 1); |
Lasse Reichstein Nielsen
2015/02/26 10:59:13
I really dislike having the body indented less tha
|
+ // Schedule all calls with exact load value and the heaviest task |
+ // assigned first. |
+ schedule(a, b, i) { |
+ if (i < limit) { |
+ schedule(a + b, a, i + 1); |
} |
- schedule(0, 1, 0); |
- // And wait for them all to complete. |
- return Future.wait(fibs).whenComplete(pool.close); |
- }); |
+ fibs[i] = pool.run(fib, i, load: a); |
+ } |
+ schedule(0, 1, 0); |
+ // And wait for them all to complete. |
+ return Future.wait(fibs).whenComplete(pool.close); |
+ }); |
} |
int computeFib(n) { |