Date: Wed, 11 Dec 2024 13:21:05 -0800
Could you give a more concrete example of what you’re referring to? If the
constructor of std::thread couldn’t start the thread, it’s supposed to
throw an exception, no? So what do you mean by “properly created”?
On Wed, Dec 11, 2024 at 1:14 PM Phil Bouchard via Std-Proposals <
std-proposals_at_[hidden]> wrote:
> Greetings,
>
> Given the following I came to realise there's no way in C++ to check if a
> thread was properly created or not (right after the equivalent C call to
> pthread_create()).
>
> So I would like to suggest adding such check in joinable() call to do so.
>
> Because under high concurrency a call to C++'s detach() can understandibly
> segfault.
>
>
> Thanks,
>
> --
> [image: Logo] <https://www.fornux.com/>
> *Phil Bouchard* [image: facebook icon]
> <https://www.linkedin.com/in/phil-bouchard-5723a910/>
> Founder & CEO
> T: (819) 328-4743
> E: phil_at_[hidden] | www.fornux.com
> 320-345 de la Gauchetière
> <https://www.google.com/maps/search/345+de+la+Gaucheti%C3%A8re?entry=gmail&source=g>
> Ouest | Montréal (Qc), H2Z 0A2 Canada
> [image: Banner] <https://static.fornux.com/c-superset/>Le message
> ci-dessus, ainsi que les documents l'accompagnant, sont destinés uniquement
> aux personnes identifiées et peuvent contenir des informations
> privilégiées, confidentielles ou ne pouvant être divulguées. Si vous avez
> reçu ce message par erreur, veuillez le détruire.
> This communication (and/or the attachments) is intended for named
> recipients only and may contain privileged or confidential information
> which is not to be disclosed. If you received this communication by mistake
> please destroy all copies.
> --
> Std-Proposals mailing list
> Std-Proposals_at_[hidden]
> https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals
>
constructor of std::thread couldn’t start the thread, it’s supposed to
throw an exception, no? So what do you mean by “properly created”?
On Wed, Dec 11, 2024 at 1:14 PM Phil Bouchard via Std-Proposals <
std-proposals_at_[hidden]> wrote:
> Greetings,
>
> Given the following I came to realise there's no way in C++ to check if a
> thread was properly created or not (right after the equivalent C call to
> pthread_create()).
>
> So I would like to suggest adding such check in joinable() call to do so.
>
> Because under high concurrency a call to C++'s detach() can understandibly
> segfault.
>
>
> Thanks,
>
> --
> [image: Logo] <https://www.fornux.com/>
> *Phil Bouchard* [image: facebook icon]
> <https://www.linkedin.com/in/phil-bouchard-5723a910/>
> Founder & CEO
> T: (819) 328-4743
> E: phil_at_[hidden] | www.fornux.com
> 320-345 de la Gauchetière
> <https://www.google.com/maps/search/345+de+la+Gaucheti%C3%A8re?entry=gmail&source=g>
> Ouest | Montréal (Qc), H2Z 0A2 Canada
> [image: Banner] <https://static.fornux.com/c-superset/>Le message
> ci-dessus, ainsi que les documents l'accompagnant, sont destinés uniquement
> aux personnes identifiées et peuvent contenir des informations
> privilégiées, confidentielles ou ne pouvant être divulguées. Si vous avez
> reçu ce message par erreur, veuillez le détruire.
> This communication (and/or the attachments) is intended for named
> recipients only and may contain privileged or confidential information
> which is not to be disclosed. If you received this communication by mistake
> please destroy all copies.
> --
> Std-Proposals mailing list
> Std-Proposals_at_[hidden]
> https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals
>
Received on 2024-12-11 21:21:20