You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@thrift.apache.org by ro...@apache.org on 2011/09/30 22:23:34 UTC

svn commit: r1177817 - /thrift/trunk/lib/cpp/src/concurrency/PosixThreadFactory.cpp

Author: roger
Date: Fri Sep 30 20:23:34 2011
New Revision: 1177817

URL: http://svn.apache.org/viewvc?rev=1177817&view=rev
Log:
THRIFT-1031 Patch to compile Thrift for vc++ 9.0 and 10.0
Patch: Peace

Modified:
    thrift/trunk/lib/cpp/src/concurrency/PosixThreadFactory.cpp

Modified: thrift/trunk/lib/cpp/src/concurrency/PosixThreadFactory.cpp
URL: http://svn.apache.org/viewvc/thrift/trunk/lib/cpp/src/concurrency/PosixThreadFactory.cpp?rev=1177817&r1=1177816&r2=1177817&view=diff
==============================================================================
--- thrift/trunk/lib/cpp/src/concurrency/PosixThreadFactory.cpp (original)
+++ thrift/trunk/lib/cpp/src/concurrency/PosixThreadFactory.cpp Fri Sep 30 20:23:34 2011
@@ -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);