This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug libstdc++/68921] [5/6 Regression] std::future::wait() makes invalid futex calls and spins
- From: "carlos at redhat dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Tue, 15 Dec 2015 19:32:05 +0000
- Subject: [Bug libstdc++/68921] [5/6 Regression] std::future::wait() makes invalid futex calls and spins
- Auto-submitted: auto-generated
- References: <bug-68921-4 at http dot gcc dot gnu dot org/bugzilla/>
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.