From: Jonathan Wakely <jwakely@redhat.com>
To: libstdc++@gcc.gnu.org, gcc-patches@gcc.gnu.org
Cc: Thomas Rodgers <trodgers@redhat.com>
Subject: [PATCH] libstdc++: Fix return values for atomic wait on futex
Date: Tue, 28 Sep 2021 20:35:38 +0100 [thread overview]
Message-ID: <YVNuivmdn6tWFc1b@redhat.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 384 bytes --]
This fixes a logic error in the futex-based timed wait.
Signed-off-by: Jonathan Wakely <jwakely@redhat.com>
libstdc++-v3/ChangeLog:
* include/bits/atomic_timed_wait.h (__platform_wait_until_impl):
Return false for ETIMEDOUT and true otherwise.
Tested x86_64-linux.
I'm not seeing any tests fail as a result of this, btu it does seem to
be incorrect. Please check my working.
[-- Attachment #2: patch.txt --]
[-- Type: text/plain, Size: 1136 bytes --]
commit 94dc544bbf42e95a363b916ed0d665afcfcccc88
Author: Jonathan Wakely <jwakely@redhat.com>
Date: Tue Aug 31 10:20:41 2021
libstdc++: Fix return values for atomic wait on futex
This fixes a logic error in the futex-based timed wait.
Signed-off-by: Jonathan Wakely <jwakely@redhat.com>
libstdc++-v3/ChangeLog:
* include/bits/atomic_timed_wait.h (__platform_wait_until_impl):
Return false for ETIMEDOUT and true otherwise.
diff --git a/libstdc++-v3/include/bits/atomic_timed_wait.h b/libstdc++-v3/include/bits/atomic_timed_wait.h
index 3db08f82707..d423a7af7c3 100644
--- a/libstdc++-v3/include/bits/atomic_timed_wait.h
+++ b/libstdc++-v3/include/bits/atomic_timed_wait.h
@@ -101,12 +101,12 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
if (__e)
{
- if ((errno != ETIMEDOUT) && (errno != EINTR)
- && (errno != EAGAIN))
+ if (errno == ETIMEDOUT)
+ return false;
+ if (errno != EINTR && errno != EAGAIN)
__throw_system_error(errno);
- return true;
}
- return false;
+ return true;
}
// returns true if wait ended before timeout
reply other threads:[~2021-09-28 19:35 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=YVNuivmdn6tWFc1b@redhat.com \
--to=jwakely@redhat.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=libstdc++@gcc.gnu.org \
--cc=trodgers@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).