This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [patch] Fix --enable-libstdcxx-time documentation, show configure result


Paolo Carlini <paolo.carlini@oracle.com> writes:
> Matthias Klose <doko@ubuntu.com> writes:
> > Noticed while looking at a developer request to build with this
> > option enabled for Debian.  I see it's not enabled for Fedora
> > either. Do other distributions enable this by default?
>
> Ok for mainline.

Hm, but does anyone have an answer to the question -- why aren't these
features enabled by default for systems which support them?

The comment in configure.ac says:

   # For clock_gettime, nanosleep and sched_yield support.
   # NB: The default is [no], because otherwise it requires linking.
   GLIBCXX_ENABLE_LIBSTDCXX_TIME([no])

which seems a bit strange -- at least on linux, these features only
"require linking" when the end-user actually uses them. 

The only effect of __GLIBCXX_USE_SCHED_YIELD and _GLIBCXX_USE_NANOSLEEP
in the libstc++ headers is to define the relevant inline methods
(std::thread::sleep_for, sleep_until, yield) in the std::thread class.

If those inline methods are never called, then they should have zero
effect (including pulling in any extra libraries etc), so it seems
like defining those macros in c++config.h would similarly have zero
effect if the facilities aren't actually used by the user.

Given that the std::thread interface is incomplete without these
enabled, and enabling them seems to have no overhead or effect unless
they're actually used (and the overhead is obviously desired in that
case!), wouldn't it be better to enable them by default?

Thanks,

-Miles

-- 
gravity a demanding master ... soft soft snow


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]