#include <atomic>
#include <condition_variable>
+#include <memory>
#include <thread>
#include <glog/logging.h>
// iteration, threads[1] performs 2 iterations, threads[2] performs
// 3 iterations, and so on.
for (uint32_t i = 0; i < kNumThreads; ++i) {
- threads[i].reset(new std::thread(Runner, &g_counter_for_mt_slow, i + 1));
+ threads[i] =
+ std::make_unique<std::thread>(Runner, &g_counter_for_mt_slow, i + 1);
}
// Variable to grab current counter value.
int32_t counter_value;
// iteration, threads[1] performs 2 iterations, threads[2] performs
// 3 iterations, and so on.
for (uint32_t i = 0; i < kNumThreads; ++i) {
- threads[i].reset(new std::thread(Runner, &g_counter_for_mt_fast, i + 1));
+ threads[i] =
+ std::make_unique<std::thread>(Runner, &g_counter_for_mt_fast, i + 1);
}
// Let the threads run to completion.
{