This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC 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]

[Bug libstdc++/58929] condition_variable does not wait without -pthread


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58929

--- Comment #3 from Johan Lundberg <lundberj at gmail dot com> ---
(In reply to Jonathan Wakely from comment #2)
> I suppose we could turn all timed waiting functions into sleeps, and wait()
> into an infinite loop, when libpthread is not linked in, but I'd prefer not
> to add that complexity.

I agree, that sounds too much.

The documentation of -pthread states that it sets flags for the preprocessor in
addition to the linker and at least on my system, _REENTRANT is set by
-pthreads. If that's a canonical way to detect threading support I suggest
checking it in the headers that rely on threading:

#ifndef _REENTRANT
#error "No thread support enabled."
#endif

If there are reasons this is not a good idea so be it.


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