You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@thrift.apache.org by "James E. King, III (JIRA)" <ji...@apache.org> on 2017/09/22 16:06:00 UTC
[jira] [Commented] (THRIFT-4258) Boost/std thread wrapping
faultiness
[ https://issues.apache.org/jira/browse/THRIFT-4258?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16176637#comment-16176637 ]
James E. King, III commented on THRIFT-4258:
--------------------------------------------
The current implementation supports C++03 as well, and I know of a number of C++03 projects that still use it.
It would be nice to have a second edition C++ runtime using boost asio, boost beast (for http transport support), and be C++11 or later only. Significant work, but it certainly would be a nice way forward.
As you noticed the older static checked-in projects are not well maintained on Windows.
I recommend you use the cmake environment to generate a windows project for C++.
See https://github.com/apache/thrift/tree/master/build/wincpp for more info on ways to do this.
> 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
> 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)