Optional replacement of pthread by boost::thread
------------------------------------------------
Key: THRIFT-1361
URL: https://issues.apache.org/jira/browse/THRIFT-1361
Project: Thrift
Issue Type: Improvement
Components: C++ - Library
Affects Versions: 0.8
Environment: Linux and Windows
Reporter: alexandre parenteau
Priority: Minor
Fix For: 0.8
What it is:
* an experimental alternative to using pthread in Thrift, by using
boost::thread and boost::interprocess instead (--enable-boostthreads)
* a way for thrift clients already depending on boost::thread to blend better
with thrift
* a solution to the Windows problem of having to link with ASF incompatible
license of pthread_win32 (GPL), add more servers and transports to WIN32
(pooled, file, pipe...), and allow for a 64bits WIN32. See THRIFT-1031 for
details.
What it is NOT:
* a replacement for the POSIX thread version of thrift: the POSIX pthread
version has more features, and is probably more stable/mature. This feature is
turned off by default by configure
* a mature code: it has been really lightly tested, and is aimed primarily at
the WIN32 platform
New dependencies:
* if --enable-boostthreads is provided, libthrift.so will link with shared
libboost_thread.so (cannot work with libboost_thread.a AFAIK). This forces in
effect Thrift to use a version of boost compiled with "./bjam link=shared"
Bugs/Testing:
* ./TestServer --server-type=thread-pool: PASS
* ./TestServer --server-type=threaded: PASS
* TFileTransportTest::test_destructor: FAILS: could not tell whether this is
because I'm using a slow (virtual) machine (as pointed by the test comment)
* Tested on Ubuntu/Windows, boost 1.44, libevent 2.0.14: however did not change
the vc10 project files, because of potential conflict with on going THRIFT-1031
* It is now possible to include more servers/transports to Win32, and also
remove all pthread_win32 dependencies
Related JIRA:
* THRIFT-1031: Windows port
Side notes:
* there are minor corrections inside PosixThreadFactory for all platforms
("started" vs "starting"...), so that Win32 port also works with pthread_win32
* TFileTransport has been enhanced to use the existing Mutex and Monitor
abstractions
* a minor fix in TSocket.cpp prevents verbose error, WIN32 only
* minor enhancement by using WSAPoll if available, WIN32 only
* on msvc10 and boost 1.44, there is a problem deep inside boost::interprocess:
boost/interprocess/detail/move.hpp needs to be patched:
{code}
index 31d108f..42aa227 100644
--- a/boost/interprocess/detail/move.hpp
+++ b/boost/interprocess/detail/move.hpp
@@ -339,7 +339,7 @@ rvalue_reference move (input_reference);
#else
template <class T> inline
typename remove_reference<T>::type&& move(T&& t)
-{ return t; }
+{ return static_cast<typename remove_reference<T>::type &&>(t); }
#endif
{code}
Please let me know of any questions, testing help appreciated (./configure
--enable-boostthreads). This is an important change for our company, to get a
Windows port of Thrift more on par with Linux features.
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira