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/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() {};