C++ Logo

std-proposals

Advanced search

Re: [std-proposals] std::thread::detach() can segfault

From: Andrey Semashev <andrey.semashev_at_[hidden]>
Date: Thu, 12 Dec 2024 00:47:45 +0300
On 12/12/24 00:30, Phil Bouchard via Std-Proposals wrote:
> You're right, it's supposed to throw an exception. So the problem is in
> the pthread library in the pthread_detach() call itself more specifically.
>
> You see, under high concurrency I'm creating simple threads followed
> immediately by detach(). And very rarely that call crashes.
>
> I'm really surprised it crashes given I assumed libpthread was the most
> tested library of all time.

Are you checking whether the pthread_create call succeeded?

Received on 2024-12-11 21:47:47