THRIFT-1031 Patch to compile Thrift for vc++ 9.0 and 10.0
Patch: Peace
git-svn-id: https://svn.apache.org/repos/asf/thrift/trunk@1177817 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/lib/cpp/src/concurrency/PosixThreadFactory.cpp b/lib/cpp/src/concurrency/PosixThreadFactory.cpp
index 8884947..fe5ba123 100644
--- a/lib/cpp/src/concurrency/PosixThreadFactory.cpp
+++ b/lib/cpp/src/concurrency/PosixThreadFactory.cpp
@@ -118,6 +118,11 @@
}
// Set thread policy
+ #ifdef _WIN32
+ //WIN32 Pthread implementation doesn't seem to support sheduling policies other then PosixThreadFactory::OTHER - runtime error
+ policy_ = PosixThreadFactory::OTHER;
+ #endif
+
if (pthread_attr_setschedpolicy(&thread_attr, policy_) != 0) {
throw SystemResourceException("pthread_attr_setschedpolicy failed");
}
@@ -245,7 +250,7 @@
max_priority = sched_get_priority_max(pthread_policy);
#endif
int quanta = (HIGHEST - LOWEST) + 1;
- float stepsperquanta = (max_priority - min_priority) / quanta;
+ float stepsperquanta = (float)(max_priority - min_priority) / quanta;
if (priority <= HIGHEST) {
return (int)(min_priority + stepsperquanta * priority);