Fix copyright lines
[folly.git] / folly / futures / test / TestExecutor.cpp
index 16f8d26dfffe1a147ce2d3d89da84449c9b12b17..9f8c0c8f96ccc98fab71fd63c6bacc9780826225 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2017 Facebook, Inc.
+ * Copyright 2017-present Facebook, Inc.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -20,9 +20,9 @@ using namespace std;
 
 namespace folly {
 
-TestExecutor::TestExecutor() {
-  const auto kWorkers = std::max(1U, thread::hardware_concurrency());
-  for (auto idx = 0U; idx < kWorkers; ++idx) {
+TestExecutor::TestExecutor(size_t numThreads) {
+  const auto kWorkers = std::max(size_t(1), numThreads);
+  for (auto idx = 0u; idx < kWorkers; ++idx) {
     workers_.emplace_back([this] {
       while (true) {
         Func work;
@@ -43,6 +43,7 @@ TestExecutor::TestExecutor() {
 
 TestExecutor::~TestExecutor() {
   for (auto& worker : workers_) {
+    (void)worker;
     addImpl({});
   }
 
@@ -57,7 +58,7 @@ void TestExecutor::add(Func f) {
   }
 }
 
-uint32_t TestExecutor::numThreads() const {
+size_t TestExecutor::numThreads() const {
   return workers_.size();
 }
 
@@ -69,4 +70,4 @@ void TestExecutor::addImpl(Func f) {
   cv_.notify_one();
 }
 
-} // folly
+} // namespace folly