THRIFT-1461 Recent TNonblockingServer changes broke --enable-boostthreads=yes, Windows
Patch: Alexandre Parenteau
git-svn-id: https://svn.apache.org/repos/asf/thrift/trunk@1214547 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/lib/cpp/src/concurrency/PlatformThreadFactory.h b/lib/cpp/src/concurrency/PlatformThreadFactory.h
index 9f053a0..04fdc5b 100644
--- a/lib/cpp/src/concurrency/PlatformThreadFactory.h
+++ b/lib/cpp/src/concurrency/PlatformThreadFactory.h
@@ -30,7 +30,6 @@
#ifndef USE_BOOST_THREAD
typedef PosixThreadFactory PlatformThreadFactory;
-#include <concurrency/PosixThreadFactory.h>
#else
typedef BoostThreadFactory PlatformThreadFactory;
#endif
diff --git a/lib/cpp/src/concurrency/PosixThreadFactory.cpp b/lib/cpp/src/concurrency/PosixThreadFactory.cpp
index 6924aa6..2019353 100644
--- a/lib/cpp/src/concurrency/PosixThreadFactory.cpp
+++ b/lib/cpp/src/concurrency/PosixThreadFactory.cpp
@@ -17,6 +17,9 @@
* under the License.
*/
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
#include "PosixThreadFactory.h"
#include "Exception.h"
diff --git a/lib/cpp/src/concurrency/Thread.h b/lib/cpp/src/concurrency/Thread.h
old mode 100644
new mode 100755
index a9e15af..654778c
--- a/lib/cpp/src/concurrency/Thread.h
+++ b/lib/cpp/src/concurrency/Thread.h
@@ -24,10 +24,18 @@
#include <boost/shared_ptr.hpp>
#include <boost/weak_ptr.hpp>
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
#ifdef USE_BOOST_THREAD
#include <boost/thread.hpp>
#endif
+#ifdef HAVE_PTHREAD_H
+#include <pthread.h>
+#endif
+
namespace apache { namespace thrift { namespace concurrency {
class Thread;
@@ -74,8 +82,13 @@
#ifdef USE_BOOST_THREAD
typedef boost::thread::id id_t;
+
+ static inline bool is_current(id_t t) { return t == boost::this_thread::get_id(); }
+ static inline id_t get_current() { return boost::this_thread::get_id(); }
#else
typedef uint64_t id_t;
+ static inline bool is_current(pthread_t t) { return pthread_equal(pthread_self(), t); }
+ static inline id_t get_current() { return pthread_self(); }
#endif
virtual ~Thread() {};
diff --git a/lib/cpp/src/concurrency/ThreadManager.cpp b/lib/cpp/src/concurrency/ThreadManager.cpp
index e56a9b5..b756bf1 100644
--- a/lib/cpp/src/concurrency/ThreadManager.cpp
+++ b/lib/cpp/src/concurrency/ThreadManager.cpp
@@ -17,6 +17,10 @@
* under the License.
*/
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
#include "ThreadManager.h"
#include "Exception.h"
#include "Monitor.h"