C++ Logo

std-proposals

Advanced search

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

From: Thiago Macieira <thiago_at_[hidden]>
Date: Wed, 11 Dec 2024 19:48:24 -0300
On Wednesday 11 December 2024 18:30:45 Brasilia Standard Time Phil Bouchard
via Std-Proposals wrote:
> 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.

Not the most tested, but one of (assuming we're talking about the glibc one,
not stuff like Android Bionic's).

The most likely scenario is that the "under high concurrency" you're talking
about contains a data race in your own code.

-- 
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
  Principal Engineer - Intel DCAI Platform & System Engineering

Received on 2024-12-11 22:48:32