|
Message-ID: <E9B8FCA610BB6249B7C397BE4A01AE194122A1@SRVDE355.weidmueller.com> Date: Tue, 27 Mar 2018 12:51:54 +0000 From: <Salman.Ahmed@...dmueller.com> To: <jens.gustedt@...ia.fr> CC: <musl@...ts.openwall.com> Subject: AW: segmentation fault on pthread_detach Hi Jens, Thanks for the clarification. So I guess with musl I have to remove the pthread_detach (which is redundant anyways after a successful join) or call it only if pthread_join returns an error? Regards Salman -----Ursprüngliche Nachricht----- Von: Jens Gustedt [mailto:jens.gustedt@...ia.fr] Gesendet: Dienstag, 27. März 2018 14:33 An: Ahmed, Salman <Salman.Ahmed@...dmueller.com> Cc: musl@...ts.openwall.com Betreff: Re: [musl] segmentation fault on pthread_detach Hello Salman, On Tue, 27 Mar 2018 12:00:39 +0000 <Salman.Ahmed@...dmueller.com> wrote: > My application using musl libc runs into a seg fault if I call > pthread_detach after pthread_join on the same thread. From my > understanding pthread_detach should return ESRCH if a previous join > was called on a particular thread. That’s the correct behavior I see > if I run my program with glibc. But on my LEDE based router I run into > the seg fault issue. The cross compiling toolchain I use is > arm_cortex-a9+neon_gcc-5.4.0_musl-1.1.16_eabi. Simple example I used > for testing is below. I don't think that your expectation is correct. The POSIX standard states: > The behavior is undefined if the value specified by the thread > argument to pthread_detach() does not refer to a joinable thread. (a thread that has already been joined is not joinable) This is for good reasons. The system must be able to dispose of all resources that a thread occupied after it has been joined. The memory will be reused, in particular there may be a new thread that uses the same identifier. Jens -- :: INRIA Nancy Grand Est ::: Camus ::::::: ICube/ICPS ::: :: ::::::::::::::: office Strasbourg : +33 368854536 :: :: :::::::::::::::::::::: gsm France : +33 651400183 :: :: ::::::::::::::: gsm international : +49 15737185122 :: :: http://icube-icps.unistra.fr/index.php/Jens_Gustedt :: ________________________________ Kommanditgesellschaft - Sitz: Detmold - Amtsgericht Lemgo HRA 2790 - Komplementärin: Weidmüller Interface Führungsgesellschaft mbH - Sitz: Detmold - Amtsgericht Lemgo HRB 3924; Geschäftsführer: José Carlos Álvarez Tobar, Elke Eckstein, Jörg Timmermann; USt-ID-Nr. DE124599660
Powered by blists - more mailing lists
Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.