public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/52680] New: std::this_thread::sleep_for #ifdef'd out by _GLIBCXX_USE_NANOSLEEP
@ 2012-03-23 1:49 mkline at cs dot wisc.edu
2012-03-23 13:17 ` [Bug c++/52680] " redi at gcc dot gnu.org
` (11 more replies)
0 siblings, 12 replies; 13+ messages in thread
From: mkline at cs dot wisc.edu @ 2012-03-23 1:49 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52680
Bug #: 52680
Summary: std::this_thread::sleep_for #ifdef'd out by
_GLIBCXX_USE_NANOSLEEP
Classification: Unclassified
Product: gcc
Version: 4.7.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: libstdc++
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: mkline@cs.wisc.edu
Created attachment 26963
--> http://gcc.gnu.org/bugzilla/attachment.cgi?id=26963
A short test program (13 lines) illustrating the problem
Inside the thread header for C++11, _GLIBCXX_USE_NANOSLEEP is not defined on my
system, causing std::this_thread::sleep_for to be undefined. However, defining
it manually using -D_GLIBCXX_USE_NANOSLEEP causes the attached test program to
compile successfully and behave as intended.
I am using Ubuntu 10.04 LTS. The attached test code was successfully compiled
using
g++ -std=c++11 test.cpp -pthread -D_GLIBCXX_USE_NANOSLEEP
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug c++/52680] std::this_thread::sleep_for #ifdef'd out by _GLIBCXX_USE_NANOSLEEP
2012-03-23 1:49 [Bug libstdc++/52680] New: std::this_thread::sleep_for #ifdef'd out by _GLIBCXX_USE_NANOSLEEP mkline at cs dot wisc.edu
@ 2012-03-23 13:17 ` redi at gcc dot gnu.org
2012-03-23 13:31 ` mkline at cs dot wisc.edu
` (10 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: redi at gcc dot gnu.org @ 2012-03-23 13:17 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52680
--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> 2012-03-23 12:45:48 UTC ---
Don't define that manually, you should configure gcc with
--enable-libstdccxx-time instead.
We need to revisit the configure tests for nanosleep and sched_yield, as they
are always available on some platforms, so we might be able to make
--enable-libstdcxx-time the default, or make the configure checks more
finegrained.
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug c++/52680] std::this_thread::sleep_for #ifdef'd out by _GLIBCXX_USE_NANOSLEEP
2012-03-23 1:49 [Bug libstdc++/52680] New: std::this_thread::sleep_for #ifdef'd out by _GLIBCXX_USE_NANOSLEEP mkline at cs dot wisc.edu
2012-03-23 13:17 ` [Bug c++/52680] " redi at gcc dot gnu.org
@ 2012-03-23 13:31 ` mkline at cs dot wisc.edu
2012-03-23 13:55 ` paolo.carlini at oracle dot com
` (9 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: mkline at cs dot wisc.edu @ 2012-03-23 13:31 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52680
--- Comment #2 from Matt Kline <mkline at cs dot wisc.edu> 2012-03-23 13:19:44 UTC ---
Thanks for shedding some light on this. Is there a reason that
--enable-libstdccxx-time isn't shown on
http://gcc.gnu.org/install/configure.html?
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug c++/52680] std::this_thread::sleep_for #ifdef'd out by _GLIBCXX_USE_NANOSLEEP
2012-03-23 1:49 [Bug libstdc++/52680] New: std::this_thread::sleep_for #ifdef'd out by _GLIBCXX_USE_NANOSLEEP mkline at cs dot wisc.edu
2012-03-23 13:17 ` [Bug c++/52680] " redi at gcc dot gnu.org
2012-03-23 13:31 ` mkline at cs dot wisc.edu
@ 2012-03-23 13:55 ` paolo.carlini at oracle dot com
2012-03-30 19:21 ` mkline at cs dot wisc.edu
` (8 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: paolo.carlini at oracle dot com @ 2012-03-23 13:55 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52680
--- Comment #3 from Paolo Carlini <paolo.carlini at oracle dot com> 2012-03-23 13:34:31 UTC ---
Should be in the *library* configure docs, no? Anyway, looking forward, now
that glibc is maintained in a slightly different way we should probably
reconsider whether we could do better about this, in terms of defaults, etc.
By the way, on Linux, I normally build with --enable-libstdcxx-time=rt
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug c++/52680] std::this_thread::sleep_for #ifdef'd out by _GLIBCXX_USE_NANOSLEEP
2012-03-23 1:49 [Bug libstdc++/52680] New: std::this_thread::sleep_for #ifdef'd out by _GLIBCXX_USE_NANOSLEEP mkline at cs dot wisc.edu
` (2 preceding siblings ...)
2012-03-23 13:55 ` paolo.carlini at oracle dot com
@ 2012-03-30 19:21 ` mkline at cs dot wisc.edu
2012-03-31 12:19 ` redi at gcc dot gnu.org
` (7 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: mkline at cs dot wisc.edu @ 2012-03-30 19:21 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52680
--- Comment #4 from Matt Kline <mkline at cs dot wisc.edu> 2012-03-30 19:19:03 UTC ---
Where should I specify that flag? _GLIBCXX_USE_NANOSLEEP is still undefined
when I build gcc with
configure CFLAGS='-O3' --disable-bootstrap --disable-multilib
--enable-ibstdccxx-time=rt --enable-languages=c,c++
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug c++/52680] std::this_thread::sleep_for #ifdef'd out by _GLIBCXX_USE_NANOSLEEP
2012-03-23 1:49 [Bug libstdc++/52680] New: std::this_thread::sleep_for #ifdef'd out by _GLIBCXX_USE_NANOSLEEP mkline at cs dot wisc.edu
` (3 preceding siblings ...)
2012-03-30 19:21 ` mkline at cs dot wisc.edu
@ 2012-03-31 12:19 ` redi at gcc dot gnu.org
2012-03-31 15:17 ` mkline at cs dot wisc.edu
` (6 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: redi at gcc dot gnu.org @ 2012-03-31 12:19 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52680
--- Comment #5 from Jonathan Wakely <redi at gcc dot gnu.org> 2012-03-31 12:02:43 UTC ---
(In reply to comment #4)
> Where should I specify that flag? _GLIBCXX_USE_NANOSLEEP is still undefined
> when I build gcc with
>
> configure CFLAGS='-O3' --disable-bootstrap --disable-multilib
> --enable-ibstdccxx-time=rt --enable-languages=c,c++
^^^^^^^^^
But what if you spell it correctly? ;)
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug c++/52680] std::this_thread::sleep_for #ifdef'd out by _GLIBCXX_USE_NANOSLEEP
2012-03-23 1:49 [Bug libstdc++/52680] New: std::this_thread::sleep_for #ifdef'd out by _GLIBCXX_USE_NANOSLEEP mkline at cs dot wisc.edu
` (4 preceding siblings ...)
2012-03-31 12:19 ` redi at gcc dot gnu.org
@ 2012-03-31 15:17 ` mkline at cs dot wisc.edu
2012-03-31 16:19 ` redi at gcc dot gnu.org
` (5 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: mkline at cs dot wisc.edu @ 2012-03-31 15:17 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52680
--- Comment #6 from Matt Kline <mkline at cs dot wisc.edu> 2012-03-31 14:52:40 UTC ---
Well this certainly isn't my brightest moment. That seems to be the problem.
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug c++/52680] std::this_thread::sleep_for #ifdef'd out by _GLIBCXX_USE_NANOSLEEP
2012-03-23 1:49 [Bug libstdc++/52680] New: std::this_thread::sleep_for #ifdef'd out by _GLIBCXX_USE_NANOSLEEP mkline at cs dot wisc.edu
` (5 preceding siblings ...)
2012-03-31 15:17 ` mkline at cs dot wisc.edu
@ 2012-03-31 16:19 ` redi at gcc dot gnu.org
2012-04-17 9:44 ` [Bug libstdc++/52680] " paolo.carlini at oracle dot com
` (4 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: redi at gcc dot gnu.org @ 2012-03-31 16:19 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52680
Jonathan Wakely <redi at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Last reconfirmed| |2012-03-31
Ever Confirmed|0 |1
Severity|normal |enhancement
--- Comment #7 from Jonathan Wakely <redi at gcc dot gnu.org> 2012-03-31 15:19:38 UTC ---
ok, great :) As I said, we do need to revisit the configure-time checks which
determine whether to use nanonsleep and sched_yield. Doing so is on my TODO
list so I'm going to confirm this PR but as an enhancement rather than a bug.
For the benefit of the other maintainers: in some off-list discussion with
Rainer I suggested that we might want to use --enable-libstdcxx-time by default
on Solaris because sched_yield is defined in libposix4 and doesn't depend on
libpthread. Additionally, we should note that librt(3LIB) on Solaris says:
"The name libposix4 is maintained for backward compatibility and should be
avoided. librt is the preferred name for this library."
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug libstdc++/52680] std::this_thread::sleep_for #ifdef'd out by _GLIBCXX_USE_NANOSLEEP
2012-03-23 1:49 [Bug libstdc++/52680] New: std::this_thread::sleep_for #ifdef'd out by _GLIBCXX_USE_NANOSLEEP mkline at cs dot wisc.edu
` (6 preceding siblings ...)
2012-03-31 16:19 ` redi at gcc dot gnu.org
@ 2012-04-17 9:44 ` paolo.carlini at oracle dot com
2012-04-17 16:36 ` mkline at cs dot wisc.edu
` (3 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: paolo.carlini at oracle dot com @ 2012-04-17 9:44 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52680
Paolo Carlini <paolo.carlini at oracle dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Component|c++ |libstdc++
--- Comment #8 from Paolo Carlini <paolo.carlini at oracle dot com> 2012-04-17 09:43:26 UTC ---
This is a library issue isn't it?
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug libstdc++/52680] std::this_thread::sleep_for #ifdef'd out by _GLIBCXX_USE_NANOSLEEP
2012-03-23 1:49 [Bug libstdc++/52680] New: std::this_thread::sleep_for #ifdef'd out by _GLIBCXX_USE_NANOSLEEP mkline at cs dot wisc.edu
` (7 preceding siblings ...)
2012-04-17 9:44 ` [Bug libstdc++/52680] " paolo.carlini at oracle dot com
@ 2012-04-17 16:36 ` mkline at cs dot wisc.edu
2012-06-05 18:15 ` redi at gcc dot gnu.org
` (2 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: mkline at cs dot wisc.edu @ 2012-04-17 16:36 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52680
--- Comment #9 from Matt Kline <mkline at cs dot wisc.edu> 2012-04-17 16:35:51 UTC ---
Yes it is. Sorry for misclassifying it.
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug libstdc++/52680] std::this_thread::sleep_for #ifdef'd out by _GLIBCXX_USE_NANOSLEEP
2012-03-23 1:49 [Bug libstdc++/52680] New: std::this_thread::sleep_for #ifdef'd out by _GLIBCXX_USE_NANOSLEEP mkline at cs dot wisc.edu
` (8 preceding siblings ...)
2012-04-17 16:36 ` mkline at cs dot wisc.edu
@ 2012-06-05 18:15 ` redi at gcc dot gnu.org
2012-11-23 22:11 ` redi at gcc dot gnu.org
2012-11-23 22:31 ` redi at gcc dot gnu.org
11 siblings, 0 replies; 13+ messages in thread
From: redi at gcc dot gnu.org @ 2012-06-05 18:15 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52680
--- Comment #10 from Jonathan Wakely <redi at gcc dot gnu.org> 2012-06-05 18:15:28 UTC ---
some ideas at http://gcc.gnu.org/ml/libstdc++/2012-05/msg00085.html
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug libstdc++/52680] std::this_thread::sleep_for #ifdef'd out by _GLIBCXX_USE_NANOSLEEP
2012-03-23 1:49 [Bug libstdc++/52680] New: std::this_thread::sleep_for #ifdef'd out by _GLIBCXX_USE_NANOSLEEP mkline at cs dot wisc.edu
` (9 preceding siblings ...)
2012-06-05 18:15 ` redi at gcc dot gnu.org
@ 2012-11-23 22:11 ` redi at gcc dot gnu.org
2012-11-23 22:31 ` redi at gcc dot gnu.org
11 siblings, 0 replies; 13+ messages in thread
From: redi at gcc dot gnu.org @ 2012-11-23 22:11 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52680
--- Comment #11 from Jonathan Wakely <redi at gcc dot gnu.org> 2012-11-23 22:11:30 UTC ---
Author: redi
Date: Fri Nov 23 22:11:23 2012
New Revision: 193769
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=193769
Log:
PR libstdc++/52680
* acinclude.m4 (GLIBCXX_ENABLE_LIBSTDCXX_TIME): Check for usleep and
sleep if nanosleep is not available. Bump libtool revision.
* config.h.in: Regenerate.
* configure: Likewise.
* config/abi/pre/gnu.ver (GLIBCXX_3.4.18): Add __sleep_for.
* include/std/thread (this_thread::__sleep_for): Add.
(this_thread::yield, this_thread::sleep_until, this_thread::sleep_for):
Declare unconditionally.
* src/c++11/thread.cc (this_thread::__sleep_for): Define.
* testsuite/lib/libstdc++.exp (check_v3_target_nanosleep): Rename to
check_v3_target_sleep.
* testsuite/lib/dg-options.exp (dg-require-nanosleep): Rename to
dg-require-sleep.
* testsuite/30_threads/condition_variable_any/53830.cc: Update.
* testsuite/30_threads/this_thread/2.cc: Likewise.
* testsuite/30_threads/this_thread/3.cc: Likewise.
* testsuite/30_threads/this_thread/4.cc: Likewise.
* testsuite/30_threads/async/54297.cc: Likewise.
Modified:
trunk/libstdc++-v3/ChangeLog
trunk/libstdc++-v3/acinclude.m4
trunk/libstdc++-v3/config.h.in
trunk/libstdc++-v3/config/abi/pre/gnu.ver
trunk/libstdc++-v3/configure
trunk/libstdc++-v3/include/std/thread
trunk/libstdc++-v3/src/c++11/thread.cc
trunk/libstdc++-v3/testsuite/30_threads/async/54297.cc
trunk/libstdc++-v3/testsuite/30_threads/condition_variable_any/53830.cc
trunk/libstdc++-v3/testsuite/30_threads/this_thread/2.cc
trunk/libstdc++-v3/testsuite/30_threads/this_thread/3.cc
trunk/libstdc++-v3/testsuite/30_threads/this_thread/4.cc
trunk/libstdc++-v3/testsuite/lib/dg-options.exp
trunk/libstdc++-v3/testsuite/lib/libstdc++.exp
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug libstdc++/52680] std::this_thread::sleep_for #ifdef'd out by _GLIBCXX_USE_NANOSLEEP
2012-03-23 1:49 [Bug libstdc++/52680] New: std::this_thread::sleep_for #ifdef'd out by _GLIBCXX_USE_NANOSLEEP mkline at cs dot wisc.edu
` (10 preceding siblings ...)
2012-11-23 22:11 ` redi at gcc dot gnu.org
@ 2012-11-23 22:31 ` redi at gcc dot gnu.org
11 siblings, 0 replies; 13+ messages in thread
From: redi at gcc dot gnu.org @ 2012-11-23 22:31 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52680
Jonathan Wakely <redi at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution| |FIXED
Target Milestone|--- |4.8.0
--- Comment #12 from Jonathan Wakely <redi at gcc dot gnu.org> 2012-11-23 22:31:14 UTC ---
fixed for 4.8, this_thread::sleep_for is always defined
^ permalink raw reply [flat|nested] 13+ messages in thread
end of thread, other threads:[~2012-11-23 22:31 UTC | newest]
Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-03-23 1:49 [Bug libstdc++/52680] New: std::this_thread::sleep_for #ifdef'd out by _GLIBCXX_USE_NANOSLEEP mkline at cs dot wisc.edu
2012-03-23 13:17 ` [Bug c++/52680] " redi at gcc dot gnu.org
2012-03-23 13:31 ` mkline at cs dot wisc.edu
2012-03-23 13:55 ` paolo.carlini at oracle dot com
2012-03-30 19:21 ` mkline at cs dot wisc.edu
2012-03-31 12:19 ` redi at gcc dot gnu.org
2012-03-31 15:17 ` mkline at cs dot wisc.edu
2012-03-31 16:19 ` redi at gcc dot gnu.org
2012-04-17 9:44 ` [Bug libstdc++/52680] " paolo.carlini at oracle dot com
2012-04-17 16:36 ` mkline at cs dot wisc.edu
2012-06-05 18:15 ` redi at gcc dot gnu.org
2012-11-23 22:11 ` redi at gcc dot gnu.org
2012-11-23 22:31 ` redi at gcc dot gnu.org
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).