core+main: switch to std::thread and thread_local

Change-Id: I892eb7d87639c2b0d24a8ed457b9d32635269216
diff --git a/daemon/main.cpp b/daemon/main.cpp
index f237a09..37f34b5 100644
--- a/daemon/main.cpp
+++ b/daemon/main.cpp
@@ -39,14 +39,12 @@
 #include <boost/program_options/options_description.hpp>
 #include <boost/program_options/parsers.hpp>
 #include <boost/program_options/variables_map.hpp>
-// boost::thread is used instead of std::thread to guarantee proper cleanup of thread local storage,
-// see https://www.boost.org/doc/libs/1_58_0/doc/html/thread/thread_local_storage.html
-#include <boost/thread.hpp>
 #include <boost/version.hpp>
 
 #include <atomic>
 #include <condition_variable>
 #include <iostream>
+#include <thread>
 
 #include <ndn-cxx/util/logging.hpp>
 #include <ndn-cxx/version.hpp>
@@ -118,33 +116,32 @@
     std::mutex m;
     std::condition_variable cv;
 
-    std::string configFile = this->m_configFile; // c++11 lambda cannot capture member variables
-    boost::thread ribThread([configFile, &retval, &ribIo, mainIo, &cv, &m] {
-        {
-          std::lock_guard<std::mutex> lock(m);
-          ribIo = &getGlobalIoService();
-          BOOST_ASSERT(ribIo != mainIo);
-          setRibIoService(ribIo);
-        }
-        cv.notify_all(); // notify that ribIo has been assigned
+    std::thread ribThread([configFile = m_configFile, &retval, &ribIo, mainIo, &cv, &m] {
+      {
+        std::lock_guard<std::mutex> lock(m);
+        ribIo = &getGlobalIoService();
+        BOOST_ASSERT(ribIo != mainIo);
+        setRibIoService(ribIo);
+      }
+      cv.notify_all(); // notify that ribIo has been assigned
 
-        try {
-          ndn::KeyChain ribKeyChain;
-          // must be created inside a separate thread
-          rib::Service ribService(configFile, ribKeyChain);
-          getGlobalIoService().run(); // ribIo is not thread-safe to use here
-        }
-        catch (const std::exception& e) {
-          NFD_LOG_FATAL(boost::diagnostic_information(e));
-          retval = 1;
-          mainIo->stop();
-        }
+      try {
+        ndn::KeyChain ribKeyChain;
+        // must be created inside a separate thread
+        rib::Service ribService(configFile, ribKeyChain);
+        getGlobalIoService().run(); // ribIo is not thread-safe to use here
+      }
+      catch (const std::exception& e) {
+        NFD_LOG_FATAL(boost::diagnostic_information(e));
+        retval = 1;
+        mainIo->stop();
+      }
 
-        {
-          std::lock_guard<std::mutex> lock(m);
-          ribIo = nullptr;
-        }
-      });
+      {
+        std::lock_guard<std::mutex> lock(m);
+        ribIo = nullptr;
+      }
+    });
 
     {
       // Wait to guarantee that ribIo is properly initialized, so it can be used to terminate