From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/8682 Path: news.gmane.org!not-for-mail From: Rich Felker Newsgroups: gmane.linux.lib.musl.general Subject: Re: [PATCH v2 2/2] pthread: implement try/timed join variants Date: Thu, 15 Oct 2015 23:15:37 -0400 Message-ID: <20151016031537.GD8645@brightrain.aerifal.cx> References: <1443988530-23978-1-git-send-email-koorogi@koorogi.info> <1443988530-23978-2-git-send-email-koorogi@koorogi.info> <20151012023020.GM8645@brightrain.aerifal.cx> Reply-To: musl@lists.openwall.com NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1444965383 32046 80.91.229.3 (16 Oct 2015 03:16:23 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 16 Oct 2015 03:16:23 +0000 (UTC) To: musl@lists.openwall.com Original-X-From: musl-return-8694-gllmg-musl=m.gmane.org@lists.openwall.com Fri Oct 16 05:16:22 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 1ZmvUm-0001fb-HU for gllmg-musl@m.gmane.org; Fri, 16 Oct 2015 05:15:52 +0200 Original-Received: (qmail 16172 invoked by uid 550); 16 Oct 2015 03:15:50 -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 16154 invoked from network); 16 Oct 2015 03:15:50 -0000 Content-Disposition: inline In-Reply-To: <20151012023020.GM8645@brightrain.aerifal.cx> User-Agent: Mutt/1.5.21 (2010-09-15) Original-Sender: Rich Felker Xref: news.gmane.org gmane.linux.lib.musl.general:8682 Archived-At: On Sun, Oct 11, 2015 at 10:30:20PM -0400, Rich Felker wrote: > > +int __pthread_timedjoin_np(pthread_t t, void **res, const struct timespec *at) > > +{ > > + int tmp, cs, r = 0; > > + __pthread_testcancel(); > > + __pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, &cs); > > + if (cs == PTHREAD_CANCEL_ENABLE) __pthread_setcancelstate(cs, 0); > > + while ((tmp = t->tid) && r != ETIMEDOUT && r != EINVAL) > > + r = __timedwait_cp(&t->tid, tmp, CLOCK_REALTIME, at, 0); > > + __pthread_setcancelstate(cs, 0); > > + if (r == ETIMEDOUT || r == EINVAL) return r; > > + return __pthread_tryjoin_np(t, res); > > +} > > + > > +int __pthread_join(pthread_t t, void **res) > > +{ > > + return __pthread_timedjoin_np(t, res, 0); > > +} > > + > > +weak_alias(__pthread_tryjoin_np, pthread_tryjoin_np); > > +weak_alias(__pthread_timedjoin_np, pthread_timedjoin_np); > > weak_alias(__pthread_join, pthread_join); > > This all looks okay to me. I'll probably commit the patch as-is, as > long as nobody thinks the reasoning on the tryjoin issue above is > wrong. I went ahead and committed patch 1 since it's an obvious bug fix. The second patch still looks ok to me but I'm going to hold off until after release because I don't want to rush addition of a new nonstandard extension without good review. Rich