From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2181) id E84A53858405; Tue, 23 Nov 2021 21:17:34 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org E84A53858405 MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: Jonathan Wakely To: gcc-cvs@gcc.gnu.org, libstdc++-cvs@gcc.gnu.org Subject: [gcc r11-9266] libstdc++: Fix return values for atomic wait on futex X-Act-Checkin: gcc X-Git-Author: Jonathan Wakely X-Git-Refname: refs/heads/releases/gcc-11 X-Git-Oldrev: 78225f05ce28321ddb8418174f4fe1e28ba08047 X-Git-Newrev: 58cd66aec9f87d742840b03206bacafbf0273a92 Message-Id: <20211123211734.E84A53858405@sourceware.org> Date: Tue, 23 Nov 2021 21:17:34 +0000 (GMT) X-BeenThere: libstdc++-cvs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libstdc++-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 23 Nov 2021 21:17:35 -0000 https://gcc.gnu.org/g:58cd66aec9f87d742840b03206bacafbf0273a92 commit r11-9266-g58cd66aec9f87d742840b03206bacafbf0273a92 Author: Jonathan Wakely Date: Tue Sep 28 20:41:46 2021 +0100 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 libstdc++-v3/ChangeLog: * include/bits/atomic_timed_wait.h (__platform_wait_until_impl): Return false for ETIMEDOUT and true otherwise. (cherry picked from commit 2fcfc7d66862c67677f0e1c46391292d5a21a567) Diff: --- libstdc++-v3/include/bits/atomic_timed_wait.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) 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