[ https://issues.apache.org/jira/browse/THRIFT-4258?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
James E. King, III closed THRIFT-4258. -------------------------------------- > Boost/std thread wrapping faultiness > ------------------------------------ > > Key: THRIFT-4258 > URL: https://issues.apache.org/jira/browse/THRIFT-4258 > Project: Thrift > Issue Type: Bug > Components: C++ - Library > Affects Versions: 0.10.0 > Environment: OS: Windows 7 64bit > Compile toolchain: Qt 5.6.0 with mingw4.9.2_32 > Reporter: Kimax Shieh > Assignee: James E. King, III > Fix For: 0.11.0 > > > I want to use std::thread instead of boost::thread, so I turn on the macro > USE_STD_THREAD manually in "windows/config.h": > {code:java} > // use std::thread in MSVC11 (2012) or newer > #if _MSC_VER >= 1700 > #define USE_STD_THREAD 1 > #else > // otherwise use boost threads > #define USE_BOOST_THREAD 1 > #endif > // Cause mingw never define _MSC_VER, > // USE_BOOST_THREAD is default set, not USE_STD_THREAD > // so here define it manually > #define USE_STD_THREAD 1 > #define USE_BOOST_THREAD 0 > {code} > Then I got a link error "undefined reference to > this_thread::detail_::interruptible_wait() in BoostMonitor.o" when compiling > my application using thrift static lib. > Why still link to boost::thread lib when I set USE_STD_THREAD on? Strange! > After hours later, I found that: > 1. StdMutex.cpp & StdMonitor.cpp are missing in My project, so I added then; > 2. BoostMutex.cpp & BoostMonitor.cpp and above 2 files didn't use > USE_BOOST_THREAD/USE_STD_THREAD macro switch, so I fixed it: > BoostMutex.cpp & BoostMonitor.cpp: > {code:java} > #include <thrift/thrift-config.h> > #if USE_BOOST_THREAD // added > // ... > #endif // added > {code} > StdMutex.cpp & StdMonitor.cpp: > {code:java} > #include <thrift/thrift-config.h> > #if USE_STD_THREAD // added > // ... > #endif // added > {code} > Then my application can be compiled successfully, without any boost binary > library, just includes. > Finally, I hope THRIFT library can be independent of boost, using C++11 > features (smart-points/thread). -- This message was sent by Atlassian JIRA (v6.4.14#64029)