diff options
Diffstat (limited to 'vespalib/src/vespa/vespalib/util/simple_thread_bundle.cpp')
-rw-r--r-- | vespalib/src/vespa/vespalib/util/simple_thread_bundle.cpp | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/vespalib/src/vespa/vespalib/util/simple_thread_bundle.cpp b/vespalib/src/vespa/vespalib/util/simple_thread_bundle.cpp index 99ab298864f..8a66a4f6898 100644 --- a/vespalib/src/vespa/vespalib/util/simple_thread_bundle.cpp +++ b/vespalib/src/vespa/vespalib/util/simple_thread_bundle.cpp @@ -157,20 +157,21 @@ SimpleThreadBundle::size() const } void -SimpleThreadBundle::run(const std::vector<Runnable*> &targets) +SimpleThreadBundle::run(Runnable* const* targets, size_t cnt) { - if (targets.size() > size()) { + if (cnt > size()) { throw IllegalArgumentException("too many targets"); } - if (targets.empty()) { + if (cnt == 0) { return; } - if (targets.size() == 1) { + if (cnt == 1) { targets[0]->run(); return; } CountDownLatch latch(size()); - _work.targets = &targets; + _work.targets = targets; + _work.cnt = cnt; _work.latch = &latch; _hook->run(); latch.await(); |