This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug libstdc++/58929] condition_variable does not wait without -pthread
- From: "lundberj at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Thu, 31 Oct 2013 16:10:42 +0000
- Subject: [Bug libstdc++/58929] condition_variable does not wait without -pthread
- Auto-submitted: auto-generated
- References: <bug-58929-4 at http dot gcc dot gnu dot org/bugzilla/>
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.