You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@thrift.apache.org by ro...@apache.org on 2011/10/19 00:19:30 UTC

svn commit: r1185904 - in /thrift/trunk: .gitignore lib/cpp/libthrift.vcxproj lib/cpp/libthriftnb.vcxproj lib/cpp/src/concurrency/BoostMonitor.cpp

Author: roger
Date: Tue Oct 18 22:19:30 2011
New Revision: 1185904

URL: http://svn.apache.org/viewvc?rev=1185904&view=rev
Log:
THRIFT-1361 Optional replacement of pthread by boost::thread
Patch: Alexandre Parenteau

Remark: lib/cpp/src/concurrency/BoostMutex.cpp is unmodified

Modified:
    thrift/trunk/.gitignore
    thrift/trunk/lib/cpp/libthrift.vcxproj
    thrift/trunk/lib/cpp/libthriftnb.vcxproj
    thrift/trunk/lib/cpp/src/concurrency/BoostMonitor.cpp

Modified: thrift/trunk/.gitignore
URL: http://svn.apache.org/viewvc/thrift/trunk/.gitignore?rev=1185904&r1=1185903&r2=1185904&view=diff
==============================================================================
--- thrift/trunk/.gitignore (original)
+++ thrift/trunk/.gitignore Tue Oct 18 22:19:30 2011
@@ -87,6 +87,7 @@
 /lib/erl/.generated
 /lib/erl/.eunit
 /lib/erl/ebin
+/lib/erl/deps/
 /lib/erl/src/thrift.app.src
 /lib/erl/test/*.erl
 /lib/erl/test/*.hrl

Modified: thrift/trunk/lib/cpp/libthrift.vcxproj
URL: http://svn.apache.org/viewvc/thrift/trunk/lib/cpp/libthrift.vcxproj?rev=1185904&r1=1185903&r2=1185904&view=diff
==============================================================================
--- thrift/trunk/lib/cpp/libthrift.vcxproj (original)
+++ thrift/trunk/lib/cpp/libthrift.vcxproj Tue Oct 18 22:19:30 2011
@@ -248,16 +248,16 @@
   </ImportGroup>
   <PropertyGroup Label="UserMacros" />
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
-    <IncludePath>$(ProjectDir)\src\;$(ProjectDir)\src\windows\;$(ProjectDir)\src\transport\;$(THIRD_PARTY)\boost\boost_1_47_0\;$(THIRD_PARTY)\pthreads\;$(THIRD_PARTY)\openssl\OpenSSL-Win32\include\;$(IncludePath)</IncludePath>
+    <IncludePath>$(ProjectDir)\src\;$(ProjectDir)\src\windows\;$(ProjectDir)\src\transport\;$(THIRD_PARTY)\boost\boost_1_47_0\include;$(THIRD_PARTY)\boost\boost_1_47_0\;$(THIRD_PARTY)\openssl\OpenSSL-Win32\include\;$(IncludePath)</IncludePath>
   </PropertyGroup>
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
-    <IncludePath>$(ProjectDir)\src\;$(ProjectDir)\src\windows\;$(ProjectDir)\src\transport\;$(THIRD_PARTY)\boost\boost_1_47_0\;$(THIRD_PARTY)\pthreads\;$(THIRD_PARTY)\openssl\OpenSSL-Win32\include\;$(IncludePath)</IncludePath>
+    <IncludePath>$(ProjectDir)\src\;$(ProjectDir)\src\windows\;$(ProjectDir)\src\transport\;$(THIRD_PARTY)\boost\boost_1_47_0\include;$(THIRD_PARTY)\boost\boost_1_47_0\;$(THIRD_PARTY)\openssl\OpenSSL-Win32\include\;$(IncludePath)</IncludePath>
   </PropertyGroup>
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
-    <IncludePath>$(ProjectDir)\src\;$(ProjectDir)\src\windows\;$(ProjectDir)\src\transport\;$(THIRD_PARTY)\boost\boost_1_47_0\;$(THIRD_PARTY)\pthreads\;$(THIRD_PARTY)\openssl\OpenSSL-Win32\include\;$(IncludePath)</IncludePath>
+    <IncludePath>$(ProjectDir)\src\;$(ProjectDir)\src\windows\;$(ProjectDir)\src\transport\;$(THIRD_PARTY)\boost\boost_1_47_0\include;$(THIRD_PARTY)\boost\boost_1_47_0\;$(THIRD_PARTY)\openssl\OpenSSL-Win32\include\;$(IncludePath)</IncludePath>
   </PropertyGroup>
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
-    <IncludePath>$(ProjectDir)\src\;$(ProjectDir)\src\windows\;$(ProjectDir)\src\transport\;$(THIRD_PARTY)\boost\boost_1_47_0\;$(THIRD_PARTY)\pthreads\;$(THIRD_PARTY)\openssl\OpenSSL-Win32\include\;$(IncludePath)</IncludePath>
+    <IncludePath>$(ProjectDir)\src\;$(ProjectDir)\src\windows\;$(ProjectDir)\src\transport\;$(THIRD_PARTY)\boost\boost_1_47_0\include;$(THIRD_PARTY)\boost\boost_1_47_0\;$(THIRD_PARTY)\openssl\OpenSSL-Win32\include\;$(IncludePath)</IncludePath>
   </PropertyGroup>
   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
     <ClCompile>

Modified: thrift/trunk/lib/cpp/libthriftnb.vcxproj
URL: http://svn.apache.org/viewvc/thrift/trunk/lib/cpp/libthriftnb.vcxproj?rev=1185904&r1=1185903&r2=1185904&view=diff
==============================================================================
--- thrift/trunk/lib/cpp/libthriftnb.vcxproj (original)
+++ thrift/trunk/lib/cpp/libthriftnb.vcxproj Tue Oct 18 22:19:30 2011
@@ -100,16 +100,16 @@
   </ImportGroup>
   <PropertyGroup Label="UserMacros" />
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
-    <IncludePath>$(ProjectDir)\src\;$(ProjectDir)\src\windows\;$(THIRD_PARTY)\boost\boost_1_47_0\;$(THIRD_PARTY)\pthreads\;$(THIRD_PARTY)\libevent\libevent-2.0.13-stable\WIN32-Code\;$(THIRD_PARTY)\libevent\libevent-2.0.13-stable\include;$(THIRD_PARTY)\libevent\libevent-2.0.13-stable\;$(IncludePath)</IncludePath>
+    <IncludePath>$(ProjectDir)\src\;$(ProjectDir)\src\windows\;$(THIRD_PARTY)\boost\boost_1_47_0\include;$(THIRD_PARTY)\boost\boost_1_47_0\;$(THIRD_PARTY)\libevent\libevent-2.0.13-stable\WIN32-Code\;$(THIRD_PARTY)\libevent\libevent-2.0.13-stable\include;$(THIRD_PARTY)\libevent\libevent-2.0.13-stable\;$(IncludePath)</IncludePath>
   </PropertyGroup>
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
-    <IncludePath>$(ProjectDir)\src\;$(ProjectDir)\src\windows\;$(THIRD_PARTY)\boost\boost_1_47_0\;$(THIRD_PARTY)\pthreads\;$(THIRD_PARTY)\libevent\libevent-2.0.13-stable\WIN32-Code\;$(THIRD_PARTY)\libevent\libevent-2.0.13-stable\include;$(THIRD_PARTY)\libevent\libevent-2.0.13-stable\;$(IncludePath)</IncludePath>
+    <IncludePath>$(ProjectDir)\src\;$(ProjectDir)\src\windows\;$(THIRD_PARTY)\boost\boost_1_47_0\include;$(THIRD_PARTY)\boost\boost_1_47_0\;$(THIRD_PARTY)\libevent\libevent-2.0.13-stable\WIN32-Code\;$(THIRD_PARTY)\libevent\libevent-2.0.13-stable\include;$(THIRD_PARTY)\libevent\libevent-2.0.13-stable\;$(IncludePath)</IncludePath>
   </PropertyGroup>
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
-    <IncludePath>$(ProjectDir)\src\;$(ProjectDir)\src\windows\;$(THIRD_PARTY)\boost\boost_1_47_0\;$(THIRD_PARTY)\pthreads\;$(THIRD_PARTY)\libevent\libevent-2.0.13-stable\WIN32-Code\;$(THIRD_PARTY)\libevent\libevent-2.0.13-stable\include;$(THIRD_PARTY)\libevent\libevent-2.0.13-stable\;$(IncludePath)</IncludePath>
+    <IncludePath>$(ProjectDir)\src\;$(ProjectDir)\src\windows\;$(THIRD_PARTY)\boost\boost_1_47_0\include;$(THIRD_PARTY)\boost\boost_1_47_0\;$(THIRD_PARTY)\libevent\libevent-2.0.13-stable\WIN32-Code\;$(THIRD_PARTY)\libevent\libevent-2.0.13-stable\include;$(THIRD_PARTY)\libevent\libevent-2.0.13-stable\;$(IncludePath)</IncludePath>
   </PropertyGroup>
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
-    <IncludePath>$(ProjectDir)\src\;$(ProjectDir)\src\windows\;$(THIRD_PARTY)\boost\boost_1_47_0\;$(THIRD_PARTY)\pthreads\;$(THIRD_PARTY)\libevent\libevent-2.0.13-stable\WIN32-Code\;$(THIRD_PARTY)\libevent\libevent-2.0.13-stable\include;$(THIRD_PARTY)\libevent\libevent-2.0.13-stable\;$(IncludePath)</IncludePath>
+    <IncludePath>$(ProjectDir)\src\;$(ProjectDir)\src\windows\;$(THIRD_PARTY)\boost\boost_1_47_0\include;$(THIRD_PARTY)\boost\boost_1_47_0\;$(THIRD_PARTY)\libevent\libevent-2.0.13-stable\WIN32-Code\;$(THIRD_PARTY)\libevent\libevent-2.0.13-stable\include;$(THIRD_PARTY)\libevent\libevent-2.0.13-stable\;$(IncludePath)</IncludePath>
   </PropertyGroup>
   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
     <ClCompile>

Modified: thrift/trunk/lib/cpp/src/concurrency/BoostMonitor.cpp
URL: http://svn.apache.org/viewvc/thrift/trunk/lib/cpp/src/concurrency/BoostMonitor.cpp?rev=1185904&r1=1185903&r2=1185904&view=diff
==============================================================================
--- thrift/trunk/lib/cpp/src/concurrency/BoostMonitor.cpp (original)
+++ thrift/trunk/lib/cpp/src/concurrency/BoostMonitor.cpp Tue Oct 18 22:19:30 2011
@@ -30,20 +30,15 @@
 #include <boost/scoped_ptr.hpp>
 #include <boost/thread.hpp>
 #include <boost/date_time/posix_time/posix_time.hpp>
-#include <boost/interprocess/sync/interprocess_mutex.hpp>
-#include <boost/interprocess/sync/interprocess_condition.hpp>
-#include <boost/interprocess/sync/scoped_lock.hpp>
 
 namespace apache { namespace thrift { namespace concurrency {
 
-using namespace boost::interprocess;
-
 /**
- * Monitor implementation using the boost interprocess library
+ * Monitor implementation using the boost thread library
  *
  * @version $Id:$
  */
-class Monitor::Impl : public interprocess_condition {
+class Monitor::Impl : public boost::condition_variable {
 
  public:
 
@@ -96,11 +91,11 @@ class Monitor::Impl : public interproces
     }
 
     assert(mutex_);
-    interprocess_mutex* mutexImpl =
-      reinterpret_cast<interprocess_mutex*>(mutex_->getUnderlyingImpl());
+	boost::mutex* mutexImpl =
+      reinterpret_cast<boost::mutex*>(mutex_->getUnderlyingImpl());
     assert(mutexImpl);
 
-	scoped_lock<interprocess_mutex> lock(*mutexImpl, accept_ownership_type());
+	boost::mutex::scoped_lock lock(*mutexImpl, boost::adopt_lock);
 	int res = timed_wait(lock, boost::get_system_time()+boost::posix_time::milliseconds(timeout_ms)) ? 0 : ETIMEDOUT;
 	lock.release();
 	return res;
@@ -112,8 +107,8 @@ class Monitor::Impl : public interproces
    */
   int waitForTime(const timespec* abstime) {
     assert(mutex_);
-    interprocess_mutex* mutexImpl =
-      reinterpret_cast<interprocess_mutex*>(mutex_->getUnderlyingImpl());
+    boost::mutex* mutexImpl =
+      reinterpret_cast<boost::mutex*>(mutex_->getUnderlyingImpl());
     assert(mutexImpl);
 
     struct timespec currenttime;
@@ -126,7 +121,7 @@ class Monitor::Impl : public interproces
 	if(tv_nsec < 0)
 		tv_nsec = 0;
 
-	scoped_lock<interprocess_mutex> lock(*mutexImpl, accept_ownership_type());
+	boost::mutex::scoped_lock lock(*mutexImpl, boost::adopt_lock);
 	int res = timed_wait(lock, boost::get_system_time() +
 		boost::posix_time::seconds(tv_sec) +
 		boost::posix_time::microseconds(tv_nsec / 1000)
@@ -141,12 +136,12 @@ class Monitor::Impl : public interproces
    */
   int waitForever() {
     assert(mutex_);
-    interprocess_mutex* mutexImpl =
-      reinterpret_cast<interprocess_mutex*>(mutex_->getUnderlyingImpl());
+    boost::mutex* mutexImpl =
+      reinterpret_cast<boost::mutex*>(mutex_->getUnderlyingImpl());
     assert(mutexImpl);
 
-	scoped_lock<interprocess_mutex> lock(*mutexImpl, accept_ownership_type());
-	((interprocess_condition*)this)->wait(lock);
+	boost::mutex::scoped_lock lock(*mutexImpl, boost::adopt_lock);
+	((boost::condition_variable*)this)->wait(lock);
 	lock.release();
     return 0;
   }