C++ Logo

std-proposals

Advanced search

Re: [std-proposals] Std-Proposals Digest, Vol 62, Issue 17

From: Giuseppe D'Angelo <giuseppe.dangelo_at_[hidden]>
Date: Thu, 9 May 2024 08:38:04 +0200
Il 09/05/24 08:30, anshul mittal via Std-Proposals ha scritto:
> >> > 4) Checking the thread id isn't sufficient, as this exposes you to ABA
> >> > problems. A thread can lock the mutex and quit, and then the same
> id may
> >> > get recycled by a new thread, which will then successfully lock the
> >> > already locked mutex. That makes no sense.
> You dont use Thread ID. You use something you know in C++.

Like what? You've mentioned thread ids in your first message:

> You can get thread id using std::this_thread::get_id().



> >> > 5) If you just want a deadlock debugging feature for mutexes, then you
> >> > can already build what you want around std::mutex. Or, just use TSAN
> >> > and/or a mutex that offers this feature out of the box, like
> It doesnt offer what i said.
>
> I developed this technology for my project and i am using it.

Do you have links to a publicly available implementation?
Have you considered contributing it to e.g. Boost?

--
Giuseppe D'Angelo

Received on 2024-05-09 06:38:10