C++ Logo

std-proposals

Advanced search

Re: Slim mutexes and locks based on C++20 std::atomic::wait

From: Ryan P. Nicholl <rnicholl_at_[hidden]>
Date: Tue, 24 Aug 2021 16:44:49 +0000
IIRC there is an alternative to futex for synchronization that can provide 64 bit locks. It's implemented as a multiple object wait system mainly for wine? (WaitForMultipleObjects?).

I think that system can be used for single object waits as well.

Sent from ProtonMail mobile

-------- Original Message --------
On Aug 24, 2021, 12:32, Thiago Macieira via Std-Proposals wrote:

> On Tuesday, 24 August 2021 00:01:53 PDT Marko Mäkelä via Std-Proposals wrote:
>> Good points. I thought that having this in the standard library would
>> create more pressure to operating system developers to provide some
>> futex-like functionality.
>
> Linux, Windows and Darwin have it, though for Darwin it doesn't appear to be
> documented. Your code has shown OpenBSD does too, something I didn't know.
> FreeBSD definitely has it for its Linux-compatibility layer, but I don't know
> if that has been exposed to the FreeBSD native ABI (just as eventfd hasn't).
>
> I don't think the standard library can force that much. We'd end up with the
> opposite: the futex functionality is emulated by way of locks. An example is
> Linux itself: Linus is quite against extending the futex functionality to 64-
> bit values, so std::atomic<int64_t>::wait will likely remain emulated on Linux
> for a long time.
>
> If this was your reason, please re-evaluate.
>
> --
> Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
> Software Architect - Intel DPG Cloud Engineering
>
> --
> Std-Proposals mailing list
> Std-Proposals_at_[hidden]
> https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals

Received on 2021-08-24 11:45:03