This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug libstdc++/68921] [5/6 Regression] std::future::wait() makes invalid futex calls and spins


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68921

Carlos O'Donell <carlos at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |carlos at redhat dot com

--- Comment #2 from Carlos O'Donell <carlos at redhat dot com> ---
(In reply to Jonathan Wakely from comment #1)
> This fixes it:
> 
> --- a/libstdc++-v3/src/c++11/futex.cc
> +++ b/libstdc++-v3/src/c++11/futex.cc
> @@ -52,7 +52,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
>         // we will fall back to spin-waiting.  The only thing we could do
>         // here on errors is abort.
>         int ret __attribute__((unused));
> -       ret = syscall (SYS_futex, __addr, futex_wait_op, __val);
> +       ret = syscall (SYS_futex, __addr, futex_wait_op, __val, nullptr);
>         _GLIBCXX_DEBUG_ASSERT(ret == 0 || errno == EINTR || errno == EAGAIN);
>         return true;
>        }

That is correct.

futex.2 from draft_futex upstream branch of linux man pages project:
~~~
If  the timeout argument is non-NULL, its contents specify a relative timeout
for the wait, measured according to the CLOCK_MONOTONIC clock.  (This  interâ
val will be rounded up to the system clock granularity, and is guaranteed not
to expire early.)  If timeout is NULL, the call blocks indefinitely.
~~~

I assume you want to block indefinitely.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]