Boost logo

Boost Users :

Subject: [Boost-users] [thread] linux.hpp, BOOST_HAS_PTHREAD_YIELD, BOOST_HAS_SCHED_YIELD
From: Rob Conde (rob.conde_at_[hidden])
Date: 2014-10-16 12:40:20


Using boost 1.55, Ubuntu 12.04, gcc 4.6

I'm building boost on linux using the lsb sdk. 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



Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net