From: Jonathan Wakely Date: Tue, 28 Sep 2021 19:41:46 +0000 (+0100) Subject: libstdc++: Fix return values for atomic wait on futex X-Git-Tag: basepoints/gcc-13~4364 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=2fcfc7d66862c67677f0e1c46391292d5a21a567;p=thirdparty%2Fgcc.git 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. --- diff --git a/libstdc++-v3/include/bits/atomic_timed_wait.h b/libstdc++-v3/include/bits/atomic_timed_wait.h index 3db08f827079..d423a7af7c30 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