Date: Wed, 11 Dec 2024 21:43:23 +0000
> 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.
It shouldn’t and it has never happened to me. If the pthread_create returns you can detach.
Not that I think using detach is a good thing to do if you want to ensure threads are properly cleaned.
I also can not say that you might not have bug in your particular implementation of std::thread.
But it is more likely that what you are doing something funny that is not quite right.
Can’t say, I haven’t seen what you are doing, and it won’t be more productive unless there is a concrete source code available capable of reproducing the issue.
Received on 2024-12-11 21:43:28