THRIFT-3498 C++ library assumes optional function pthread_attr_setschedpolicy 
is available
Client: C++
Patch: Simon South

PosixThreadFactory.cpp: Test for availability of optional
pthread_attr_setschedpolicy function before including in source code

This closes #754


Project: http://git-wip-us.apache.org/repos/asf/thrift/repo
Commit: http://git-wip-us.apache.org/repos/asf/thrift/commit/117af5c3
Tree: http://git-wip-us.apache.org/repos/asf/thrift/tree/117af5c3
Diff: http://git-wip-us.apache.org/repos/asf/thrift/diff/117af5c3

Branch: refs/heads/master
Commit: 117af5c3a3216c1bb21a38d395032c2016116300
Parents: ad83586
Author: Simon South <[email protected]>
Authored: Mon Dec 21 14:01:36 2015 -0500
Committer: Nobuaki Sukegawa <[email protected]>
Committed: Sun Jan 3 02:40:38 2016 +0900

----------------------------------------------------------------------
 lib/cpp/src/thrift/concurrency/PosixThreadFactory.cpp | 2 ++
 1 file changed, 2 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/thrift/blob/117af5c3/lib/cpp/src/thrift/concurrency/PosixThreadFactory.cpp
----------------------------------------------------------------------
diff --git a/lib/cpp/src/thrift/concurrency/PosixThreadFactory.cpp 
b/lib/cpp/src/thrift/concurrency/PosixThreadFactory.cpp
index 47c5034..05a3c02 100644
--- a/lib/cpp/src/thrift/concurrency/PosixThreadFactory.cpp
+++ b/lib/cpp/src/thrift/concurrency/PosixThreadFactory.cpp
@@ -124,9 +124,11 @@ public:
     policy_ = PosixThreadFactory::OTHER;
 #endif
 
+#if _POSIX_THREAD_PRIORITY_SCHEDULING > 0
     if (pthread_attr_setschedpolicy(&thread_attr, policy_) != 0) {
       throw SystemResourceException("pthread_attr_setschedpolicy failed");
     }
+#endif
 
     struct sched_param sched_param;
     sched_param.sched_priority = priority_;

Reply via email to