[
https://issues.apache.org/jira/browse/THRIFT-3498?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15066903#comment-15066903
]
ASF GitHub Bot commented on THRIFT-3498:
----------------------------------------
GitHub user simonsouth opened a pull request:
https://github.com/apache/thrift/pull/754
THRIFT-3498 C++ library assumes optional function
pthread_attr_setschedpolicy is available
This patch allows Thrift to build on Haiku and other systems that do not
implement POSIX's thread-execution scheduling option. It adds a check around
the call to `pthread_attr_setschedpolicy` in the C++ library.
[According to
POSIX](http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/unistd.h.html#tag_13_77_03_02)
`_POSIX_THREAD_PRIORITY_SCHEDULING` should be defined in `unistd.h` with a
value greater than zero if the `pthread_attr_setschedpolicy` function is known
to be available at runtime.
`PosixThreadFactory.cpp`: Test for availability of optional
`pthread_attr_setschedpolicy` function before including in source code
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/simonsouth/thrift
thrift-3498-c++-library-assumes-optional-function
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/thrift/pull/754.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #754
----
commit 69ae417ce33526457e41b8458f9c5d25e11f3992
Author: Simon South <[email protected]>
Date: 2015-12-21T19:01:36Z
THRIFT-3498 C++ library assumes optional function
pthread_attr_setschedpolicy is available
PosixThreadFactory.cpp: Test for availability of optional
pthread_attr_setschedpolicy function before including in source code
----
> C++ library assumes optional function pthread_attr_setschedpolicy is available
> ------------------------------------------------------------------------------
>
> Key: THRIFT-3498
> URL: https://issues.apache.org/jira/browse/THRIFT-3498
> Project: Thrift
> Issue Type: Bug
> Components: C++ - Library
> Affects Versions: 0.9.4
> Environment: gcc 4.8.5 on Haiku hrev49934 (x86)
> Reporter: Simon South
> Assignee: Simon South
> Priority: Minor
> Labels: c++, haiku, library, posix
>
> Building on [Haiku|http://haiku-os.org/] the latest code from git fails with
> {noformat}
> src/thrift/concurrency/PosixThreadFactory.cpp: In member function 'virtual
> void apache::thrift::concurrency::PthreadThread::start()':
> src/thrift/concurrency/PosixThreadFactory.cpp:127:58: error:
> 'pthread_attr_setschedpolicy' was not declared in this scope
> if (pthread_attr_setschedpolicy(&thread_attr, policy_) != 0) {
> {noformat}
> This is because {{pthread_attr_setschedpolicy}} is in fact an optional
> function POSIX implementations are not required to provide—and Haiku's
> POSIX-compatibility layer does not.
> Thrift should be checking for the availability of this function before
> including it in the source code. (Nothing else seems to rely on the
> thread-scheduling policy being available, so it's just a matter of omitting
> this one function call.)
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)