X-Git-Url: http://plrg.eecs.uci.edu/git/?a=blobdiff_plain;f=folly%2Fgen%2FParallel-inl.h;h=25d959d5a952258f257ef594f646f70af650d988;hb=f975d3c54800b7065985e5e548ce1d91fef4926c;hp=4c4156cf81f5a0686a8c54bca468ce7ada4fce9e;hpb=108473868b7d543fcb4f7108cbcc75dc871cd833;p=folly.git diff --git a/folly/gen/Parallel-inl.h b/folly/gen/Parallel-inl.h index 4c4156cf..25d959d5 100644 --- a/folly/gen/Parallel-inl.h +++ b/folly/gen/Parallel-inl.h @@ -1,5 +1,5 @@ /* - * Copyright 2016 Facebook, Inc. + * Copyright 2017 Facebook, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -49,7 +49,7 @@ class ClosableMPMCQueue { void openConsumer() { ++consumers_; } void closeInputProducer() { - int64_t producers = producers_--; + size_t producers = producers_--; CHECK(producers); if (producers == 1) { // last producer wakeConsumer_.notifyAll(); @@ -57,7 +57,7 @@ class ClosableMPMCQueue { } void closeOutputConsumer() { - int64_t consumers = consumers_--; + size_t consumers = consumers_--; CHECK(consumers); if (consumers == 1) { // last consumer wakeProducer_.notifyAll(); @@ -132,11 +132,12 @@ class Sub : public Operator> { public: explicit Sub(Sink sink) : sink_(sink) {} - template ().compose(std::declval())), - class Just = SingleCopy::type>> + template < + class Value, + class Source, + class Result = + decltype(std::declval().compose(std::declval())), + class Just = SingleCopy::type>> Just compose(const GenImpl& source) const { return Just(source | sink_); } @@ -150,13 +151,14 @@ class Parallel : public Operator> { public: Parallel(Ops ops, size_t threads) : ops_(std::move(ops)), threads_(threads) {} - template ::type, - class Composed = - decltype(std::declval().compose(Empty())), - class Output = typename Composed::ValueType, - class OutputDecayed = typename std::decay::type> + template < + class Input, + class Source, + class InputDecayed = typename std::decay::type, + class Composed = + decltype(std::declval().compose(Empty())), + class Output = typename Composed::ValueType, + class OutputDecayed = typename std::decay::type> class Generator : public GenImpl> { : source_(std::move(source)), ops_(std::move(ops)), threads_( - threads ? threads - : std::max(1, sysconf(_SC_NPROCESSORS_CONF))) {} + threads + ? threads + : size_t(std::max(1, sysconf(_SC_NPROCESSORS_CONF)))) {} template bool apply(Handler&& handler) const {