[PATCH] Add c++2a binary_semaphore
Jonathan Wakely
jwakely@redhat.com
Wed Feb 26 16:07:00 GMT 2020
On 24/02/20 21:53 -0500, Thomas Rodgers wrote:
>+ bool
>+ _S_futex_wait_until(int* __addr, int __val,
>+ bool __has_timeout = false,
>+ std::chrono::seconds __s = std::chrono::seconds::zero(),
>+ std::chrono::nanoseconds __ns = std::chrono::nanoseconds::zero())
>+ {
>+ if (!__has_timeout)
>+ {
>+ syscall (SYS_futex, __addr, 0, __val, nullptr);
>+ // Can't do anything about an error here except abort, so ignore it.
>+ }
>+ else
>+ {
>+ struct timeval __tv;
>+ gettimeofday(&__tv, NULL);
>+ struct timespec __rt;
>+ __rt.tv_sec = __s.count() - __tv.tv_sec;
>+ __rt.tv_nsec = __ns.count() - __tv.tv_usec * 1000;
>+ if (__rt.tv_nsec < 0)
>+ {
>+ __rt.tv_nsec += 1000000000;
>+ --__rt.tv_sec;
>+ }
>+ if (__rt.tv_sec < 0)
>+ return false;
>+
>+ if (syscall (SYS_futex, __addr, 0, __val, &__rt) == -1)
This syscall has the same problem as https://gcc.gnu.org/PR93421 so we
should avoid introducing a new instance of the bug.
More information about the Libstdc++
mailing list