Futex::futexWait returns FutexResult
[folly.git] / folly / test / SingletonThreadLocalTest.cpp
index 72ebfd8e0de027f5193792614ca03a988e2ef065..8397bb88e2c0f0cb7b31ca437e6fcee23a528dde 100644 (file)
@@ -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.
@@ -37,21 +37,20 @@ struct Foo {
 };
 using FooSingletonTL = SingletonThreadLocal<Foo>;
 FooSingletonTL theFooSingleton;
-}
+} // namespace
 
 TEST(SingletonThreadLocalTest, OneSingletonPerThread) {
-  const std::size_t targetThreadCount{64};
+  static constexpr std::size_t targetThreadCount{64};
   std::atomic<std::size_t> completedThreadCount{0};
   Synchronized<std::unordered_set<Foo*>> fooAddresses{};
   std::vector<std::thread> threads{};
-  auto threadFunction =
-      [&fooAddresses, targetThreadCount, &completedThreadCount] {
-        fooAddresses.wlock()->emplace(&FooSingletonTL::get());
-        ++completedThreadCount;
-        while (completedThreadCount < targetThreadCount) {
-          std::this_thread::yield();
-        }
-      };
+  auto threadFunction = [&fooAddresses, &completedThreadCount] {
+    fooAddresses.wlock()->emplace(&FooSingletonTL::get());
+    ++completedThreadCount;
+    while (completedThreadCount < targetThreadCount) {
+      std::this_thread::yield();
+    }
+  };
   {
     for (std::size_t threadCount{0}; threadCount < targetThreadCount;
          ++threadCount) {