From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/8534 Path: news.gmane.org!not-for-mail From: Julien Ramseier Newsgroups: gmane.linux.lib.musl.general Subject: Re: pthread_join stuck in infinite loop Date: Mon, 21 Sep 2015 11:00:48 +0200 Message-ID: <718FD117-B781-4ADA-A714-8C07392134B0@gmail.com> References: <20150920182936.GC10551@port70.net> <1442774496.24315.5.camel@inria.fr> Reply-To: musl@lists.openwall.com NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 (Mac OS X Mail 8.2 \(2102\)) Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1442826071 380 80.91.229.3 (21 Sep 2015 09:01:11 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 21 Sep 2015 09:01:11 +0000 (UTC) To: musl@lists.openwall.com Original-X-From: musl-return-8546-gllmg-musl=m.gmane.org@lists.openwall.com Mon Sep 21 11:01:06 2015 Return-path: Envelope-to: gllmg-musl@m.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by plane.gmane.org with smtp (Exim 4.69) (envelope-from ) id 1Zdwy9-0001xS-Dl for gllmg-musl@m.gmane.org; Mon, 21 Sep 2015 11:01:05 +0200 Original-Received: (qmail 3789 invoked by uid 550); 21 Sep 2015 09:01:02 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: Original-Received: (qmail 3762 invoked from network); 21 Sep 2015 09:01:02 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=content-type:mime-version:subject:from:in-reply-to:date :content-transfer-encoding:message-id:references:to; bh=ZEK5nSD37Z9YHlXH5BD4oE3NNko/LDzKqFcYKCsP5Lk=; b=Uz/mEMyWpGXaA83eMEq0VrJZrh+xXgf/uVGQGFKRWvmrs8kppARPU2ozgKYM5sXLst TORL278rUHL5PsflY70swb3vcZHjSCCbP9Nz9485IVQaaiksy3JSxeX8HgzdOAMfUfI0 uHrsJ9wGhUYbb5JSDuycXed+/lrFnr2G1Sr+Y65AuFcvAxJiz4c1sdPOTG3s5sk1vBum JbaPZsoRRstt/NkIMykoSYrowjQYWTMUKVyDzD8AG8FNbJkZ9Jc7ITRSq/WS78iCgf7D BNmRRpxBXS9ycwjrXFyaEQyk/7SeKQ4RAA2lotNxrW5C64EI89V+yQg1U/UAuqzMK4pm 3Mzw== X-Received: by 10.180.85.164 with SMTP id i4mr12859622wiz.54.1442826050802; Mon, 21 Sep 2015 02:00:50 -0700 (PDT) In-Reply-To: <1442774496.24315.5.camel@inria.fr> X-Mailer: Apple Mail (2.2102) Xref: news.gmane.org gmane.linux.lib.musl.general:8534 Archived-At: Thanks for the explanations. I was misled by the glibc doc. Julien > Le 20 sept. 2015 =C3=A0 20:41, Jens Gustedt a = =C3=A9crit : >=20 > Am Sonntag, den 20.09.2015, 20:29 +0200 schrieb Szabolcs Nagy: >> * Julien Ramseier [2015-09-20 20:07:28 +0200]: >>> pthread_join() never returns when calling it on a detached thread. >>> I would expect it to return EINVAL instead. >> [...] >> in particular the glibc man page says EINVAL is correctly >> reported in all cases which i dont think is true: there >> is a race between the detached thread exiting an join. >=20 > Yes, in general this is simply not possible. Otherwise the system > would have to keep track of all threads that had been started by the > process. The idea of detaching a thread (or starting it detached) is > that the system resources that it occupies can be freed as soon as it > exits. >=20 > So just don't make the assumption that you may call join in such a > situation. The resources of the thread and the thread ID may even > already have been attributed to a new thread that started after the > first one has exited. So you are not even sure which thread your id is > naming. >=20 > Jens