diff options
author | Jonathan Wakely <jwakely@redhat.com> | 2018-10-11 17:37:23 +0100 |
---|---|---|
committer | Jonathan Wakely <redi@gcc.gnu.org> | 2018-10-11 17:37:23 +0100 |
commit | cfef4c324ac300c0ad120f0fcee376159de84a0c (patch) | |
tree | 9b0e03e36a75417b591a69a6f9f7405dbbc6f053 /gcc/real.c | |
parent | 2045ae1d3f511717c2a1223148ce63f71800e1dd (diff) | |
download | gcc-cfef4c324ac300c0ad120f0fcee376159de84a0c.zip gcc-cfef4c324ac300c0ad120f0fcee376159de84a0c.tar.gz gcc-cfef4c324ac300c0ad120f0fcee376159de84a0c.tar.bz2 |
PR libstdc++/80538 Only call sleep for non-zero values
Avoid a system call when no sleep is required. Sleep in a loop (actually
two loops) to handle interruption by signals.
PR libstdc++/80538
* src/c++11/thread.cc (this_thread::__sleep_for)
[_GLIBCXX_HAVE_SLEEP]: Only call sleep for non-zero values.
Loop while sleep call is interrupted and until steady_clock
shows requested duration has elapsed.
(!_GLIBCXX_HAVE_USLEEP]: Use the _GLIBCXX_HAVE_SLEEP code path, but
avoiding the usleep call.
* testsuite/30_threads/this_thread/60421.cc: Test repeated
signal interruptions.
From-SVN: r265044
Diffstat (limited to 'gcc/real.c')
0 files changed, 0 insertions, 0 deletions