From d37d348da87ea0e87edf158edfa62fd20a325ad3 Mon Sep 17 00:00:00 2001 From: Dmitri Smirnov Date: Fri, 19 Feb 2016 12:29:54 -0800 Subject: [PATCH] This addresses build issues on Windows https://github.com/facebook/rocksdb/issues/1002 --- db/auto_roll_logger.h | 1 + util/thread_local_test.cc | 14 ++++++++++---- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/db/auto_roll_logger.h b/db/auto_roll_logger.h index 6bf79c5c6..0e4974d4d 100644 --- a/db/auto_roll_logger.h +++ b/db/auto_roll_logger.h @@ -14,6 +14,7 @@ #include "port/port.h" #include "port/util_logger.h" #include "util/sync_point.h" +#include "util/mutexlock.h" namespace rocksdb { diff --git a/util/thread_local_test.cc b/util/thread_local_test.cc index f531dfd0c..3fc5bc288 100644 --- a/util/thread_local_test.cc +++ b/util/thread_local_test.cc @@ -3,7 +3,7 @@ // LICENSE file in the root directory of this source tree. An additional grant // of patent rights can be found in the PATENTS file in the same directory. -#include +#include #include #include @@ -496,9 +496,15 @@ TEST_F(ThreadLocalTest, DISABLED_MainThreadDiesFirst) { // Triggers the initialization of singletons. Env::Default(); - pthread_t t; - pthread_create(&t, nullptr, &AccessThreadLocal, nullptr); - TEST_SYNC_POINT("MainThreadDiesFirst:End"); + + try { + std::thread th(&AccessThreadLocal, nullptr); + th.detach(); + TEST_SYNC_POINT("MainThreadDiesFirst:End"); + } catch (const std::system_error& ex) { + std::cerr << "Start thread: " << ex.code() << std::endl; + ASSERT_TRUE(false); + } } } // namespace rocksdb