Fix lambda expression for clang/windows

Summary:
make the variables static so capturing is unnecessary since I couldn't
find a portable way to capture variables in a lambda that's converted to a
C-style pointer-to-function.

Test Plan: https://ci.appveyor.com/project/Facebook/rocksdb/build/1.0.1658

Subscribers: andrewkr, dhruba, leveldb

Differential Revision: https://reviews.facebook.net/D62403
main
Andrew Kryczka 8 years ago
parent 5440675c3d
commit f57bc1d034
  1. 6
      util/thread_local_test.cc

@ -461,12 +461,12 @@ TEST_F(ThreadLocalTest, Fold) {
auto unref = [](void* ptr) { auto unref = [](void* ptr) {
delete static_cast<std::atomic<int64_t>*>(ptr); delete static_cast<std::atomic<int64_t>*>(ptr);
}; };
const int kNumThreads = 16; static const int kNumThreads = 16;
const int kItersPerThread = 10; static const int kItersPerThread = 10;
port::Mutex mu; port::Mutex mu;
port::CondVar cv(&mu); port::CondVar cv(&mu);
Params params(&mu, &cv, nullptr, kNumThreads, unref); Params params(&mu, &cv, nullptr, kNumThreads, unref);
auto func = [&](void* ptr) { auto func = [](void* ptr) {
auto& p = *static_cast<Params*>(ptr); auto& p = *static_cast<Params*>(ptr);
ASSERT_TRUE(p.tls1.Get() == nullptr); ASSERT_TRUE(p.tls1.Get() == nullptr);
p.tls1.Reset(new std::atomic<int64_t>(0)); p.tls1.Reset(new std::atomic<int64_t>(0));

Loading…
Cancel
Save