THRIFT-1031 Patch to compile Thrift for vc++ 9.0 and 10.0
authorRoger Meier <roger@apache.org>
Fri, 30 Sep 2011 20:23:34 +0000 (20:23 +0000)
committerRoger Meier <roger@apache.org>
Fri, 30 Sep 2011 20:23:34 +0000 (20:23 +0000)
Patch: Peace

git-svn-id: https://svn.apache.org/repos/asf/thrift/trunk@1177817 13f79535-47bb-0310-9956-ffa450edef68

lib/cpp/src/concurrency/PosixThreadFactory.cpp

index 8884947..fe5ba12 100644 (file)
@@ -118,6 +118,11 @@ class PthreadThread: public Thread {
     }
 
     // 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 @@ class PosixThreadFactory::Impl {
     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);