THRIFT-1031 Patch to compile Thrift for vc++ 9.0 and 10.0
Patch: James Dickson and Alexandre Parenteau
git-svn-id: https://svn.apache.org/repos/asf/thrift/trunk@1171777 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/lib/cpp/src/concurrency/PosixThreadFactory.cpp b/lib/cpp/src/concurrency/PosixThreadFactory.cpp
index d42288c..8884947 100644
--- a/lib/cpp/src/concurrency/PosixThreadFactory.cpp
+++ b/lib/cpp/src/concurrency/PosixThreadFactory.cpp
@@ -68,7 +68,11 @@
public:
PthreadThread(int policy, int priority, int stackSize, bool detached, shared_ptr<Runnable> runnable) :
+
+#ifndef _WIN32
pthread_(0),
+#endif // _WIN32
+
state_(uninitialized),
policy_(policy),
priority_(priority),
@@ -152,7 +156,12 @@
}
Thread::id_t getId() {
+
+#ifndef _WIN32
return (Thread::id_t)pthread_;
+#else
+ return (Thread::id_t)pthread_.p;
+#endif // _WIN32
}
shared_ptr<Runnable> runnable() const { return Thread::runnable(); }
@@ -286,7 +295,13 @@
void setDetached(bool value) { detached_ = value; }
Thread::id_t getCurrentThreadId() const {
+
+#ifndef _WIN32
return (Thread::id_t)pthread_self();
+#else
+ return (Thread::id_t)pthread_self().p;
+#endif // _WIN32
+
}
};