[thread] linux.hpp, BOOST_HAS_PTHREAD_YIELD, BOOST_HAS_SCHED_YIELD
Reposting this here since I got no response on "users" but this list seems more appropriate: Using boost 1.55, Ubuntu 12.04, gcc 4.6 I'm building boost on linux using the lsb sdk (4.1.8) . I was getting the failure (paraphrased): pthread_yield not declared in libs/thread/src/thread.cpp 513 The documentation for pthread_yield (http://man7.org/linux/man-pages/man3/pthread_yield.3.html) says: This call is nonstandard, but present on several other systems. Use the standardized sched_yield(2)http://man7.org/linux/man-pages/man2/sched_yield.2.html instead. If I change boost/config/platform/linux.hpp to define BOOST_HAS_SCHED_YIELD instead of BOOST_HAS_PTHREAD_YIELD Then sched_yield is used instead and the build finishes properly. I'm posting this for two reasons: 1. To help others running into the same issue 2. To question whether linux.hpp should be updated officially as I did above 3. If not, why Thanks, Rob Conde
Reposting this here since I got no response on "users" but this list seems more appropriate:
Apologies for not replying before.
Using boost 1.55, Ubuntu 12.04, gcc 4.6
I'm building boost on linux using the lsb sdk (4.1.8) . I was getting the failure (paraphrased):
pthread_yield not declared
in libs/thread/src/thread.cpp 513
Weird. Fairly obviously that's a well tested combination, and normally
both BOOST_HAS_PTHREAD_YIELD and BOOST_HAS_SCHED_YIELD will get defined.
The former is a GNU extension, and I really should figure out what
define triggers it's presence (_GNU_SOURCE probably, but I need to
check). The latter is set in posix_features.hpp via:
# if defined(_POSIX_PRIORITY_SCHEDULING) &&
(_POSIX_PRIORITY_SCHEDULING+0 > 0)\
|| (defined(_POSIX_THREAD_PRIORITY_SCHEDULING) &&
(_POSIX_THREAD_PRIORITY_SCHEDULING+0 > 0))\
|| (defined(_XOPEN_REALTIME) && (_XOPEN_REALTIME+0 >= 0))
# define BOOST_HAS_SCHED_YIELD
# endif
So for whatever reason, your version of
The documentation for pthread_yield (http://man7.org/linux/man-pages/man3/pthread_yield.3.html) says:
This call is nonstandard, but present on several other systems. Use the standardized sched_yield(2)http://man7.org/linux/man-pages/man2/sched_yield.2.html instead.
If I change boost/config/platform/linux.hpp to define
BOOST_HAS_SCHED_YIELD
instead of
BOOST_HAS_PTHREAD_YIELD
Then sched_yield is used instead and the build finishes properly.
I'm posting this for two reasons:
1. To help others running into the same issue 2. To question whether linux.hpp should be updated officially as I did above 3. If not, why
Thanks,
Rob Conde
_______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
Ah...ok I had to pass:
-U_GNU_SOURCE
to get things to build for a different reason. So let me check that out before you dig any further.
Thanks,
Rob
________________________________________
From: Boost
Reposting this here since I got no response on "users" but this list seems more appropriate:
Apologies for not replying before.
Using boost 1.55, Ubuntu 12.04, gcc 4.6
I'm building boost on linux using the lsb sdk (4.1.8) . I was getting the failure (paraphrased):
pthread_yield not declared
in libs/thread/src/thread.cpp 513
Weird. Fairly obviously that's a well tested combination, and normally
both BOOST_HAS_PTHREAD_YIELD and BOOST_HAS_SCHED_YIELD will get defined.
The former is a GNU extension, and I really should figure out what
define triggers it's presence (_GNU_SOURCE probably, but I need to
check). The latter is set in posix_features.hpp via:
# if defined(_POSIX_PRIORITY_SCHEDULING) &&
(_POSIX_PRIORITY_SCHEDULING+0 > 0)\
|| (defined(_POSIX_THREAD_PRIORITY_SCHEDULING) &&
(_POSIX_THREAD_PRIORITY_SCHEDULING+0 > 0))\
|| (defined(_XOPEN_REALTIME) && (_XOPEN_REALTIME+0 >= 0))
# define BOOST_HAS_SCHED_YIELD
# endif
So for whatever reason, your version of
The documentation for pthread_yield (http://man7.org/linux/man-pages/man3/pthread_yield.3.html) says:
This call is nonstandard, but present on several other systems. Use the standardized sched_yield(2)http://man7.org/linux/man-pages/man2/sched_yield.2.html instead.
If I change boost/config/platform/linux.hpp to define
BOOST_HAS_SCHED_YIELD
instead of
BOOST_HAS_PTHREAD_YIELD
Then sched_yield is used instead and the build finishes properly.
I'm posting this for two reasons:
1. To help others running into the same issue 2. To question whether linux.hpp should be updated officially as I did above 3. If not, why
Thanks,
Rob Conde
_______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
_______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
Ok - the lsb 4.1 version of unistd.h does not define _POSIX_PRIORITY_SCHEDULING, even though sched_yield is part of the 4.1 specification and, as you pointed out, the linux man pages say that it should.
I'll file a bug with lsb.
Thanks,
Rob Conde
________________________________________
From: Boost
Reposting this here since I got no response on "users" but this list seems more appropriate:
Apologies for not replying before.
Using boost 1.55, Ubuntu 12.04, gcc 4.6
I'm building boost on linux using the lsb sdk (4.1.8) . I was getting the failure (paraphrased):
pthread_yield not declared
in libs/thread/src/thread.cpp 513
Weird. Fairly obviously that's a well tested combination, and normally
both BOOST_HAS_PTHREAD_YIELD and BOOST_HAS_SCHED_YIELD will get defined.
The former is a GNU extension, and I really should figure out what
define triggers it's presence (_GNU_SOURCE probably, but I need to
check). The latter is set in posix_features.hpp via:
# if defined(_POSIX_PRIORITY_SCHEDULING) &&
(_POSIX_PRIORITY_SCHEDULING+0 > 0)\
|| (defined(_POSIX_THREAD_PRIORITY_SCHEDULING) &&
(_POSIX_THREAD_PRIORITY_SCHEDULING+0 > 0))\
|| (defined(_XOPEN_REALTIME) && (_XOPEN_REALTIME+0 >= 0))
# define BOOST_HAS_SCHED_YIELD
# endif
So for whatever reason, your version of
The documentation for pthread_yield (http://man7.org/linux/man-pages/man3/pthread_yield.3.html) says:
This call is nonstandard, but present on several other systems. Use the standardized sched_yield(2)http://man7.org/linux/man-pages/man2/sched_yield.2.html instead.
If I change boost/config/platform/linux.hpp to define
BOOST_HAS_SCHED_YIELD
instead of
BOOST_HAS_PTHREAD_YIELD
Then sched_yield is used instead and the build finishes properly.
I'm posting this for two reasons:
1. To help others running into the same issue 2. To question whether linux.hpp should be updated officially as I did above 3. If not, why
Thanks,
Rob Conde
_______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
_______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
participants (2)
-
John Maddock
-
Rob Conde