C++ Logo

std-proposals

Advanced search

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

From: Ville Voutilainen <ville.voutilainen_at_[hidden]>
Date: Mon, 30 Aug 2021 21:48:46 +0300
On Mon, 30 Aug 2021 at 21:41, Thiago Macieira <thiago_at_[hidden]> wrote:
>
> On Monday, 30 August 2021 11:28:58 PDT Ville Voutilainen wrote:
> > > mutex = spinlock + futex (wait / wake) + optional goodies
> >
> > Oh, I know where it sits in the abstraction-hierarchy of these things,
> > but that doesn't make
> > it in any way obvious that it should go first.
>
> I'm not saying that spinlocks are required for slim mutexes or the other way
> around. It is possible they will share some code, though.
>
> I am saying that people are writing bad code for spinlocks today and my
> evidence is that I found an example thereof inside libstdc++. So I am claiming
> this is a bigger problem.

Maybe, for the users to whom it is a problem. The atomic_mutex
proposal is solving a completely
different problem, and it's just a more efficient mutex, so in that
sense I don't have to guess where
it could be applied and how, and who would use it and for what. Saying
that spinlocks, where they
actually appear in user code, are a problem that needs to be solved
first is a bit like saying "I don't
want your foo, please propose bar instead", to which there's a variety
of answers, including
"propose it yourself". :P

In other words, you have a claim, fine. Substantiate it, and I'm all
ears, and so are, ostensibly,
many other people.

Received on 2021-08-30 13:49:02