From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS31976 209.132.180.0/23 X-Spam-Status: No, score=-3.2 required=3.0 tests=AWL,BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED, SPF_HELO_PASS,SPF_PASS shortcircuit=no autolearn=ham autolearn_force=no version=3.4.1 Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dcvr.yhbt.net (Postfix) with ESMTPS id C6E1E1F85E for ; Thu, 12 Jul 2018 19:32:55 +0000 (UTC) DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:subject:from:to:references:message-id:date :mime-version:in-reply-to:content-type :content-transfer-encoding; q=dns; s=default; b=wiIAfEuFwllR1ah+ ANIKb8opWu/DUyjhGiICzUIff4tChcMLsb5nsK4D51N2sr1al1HQhdFbuS9BabnC ltkrWcrno8zE8XNnPz4txio7gmVGoHlElLEhGnLoOIPRgSSF9gyogOClaSEKfPHr Fn4gX5JoTN3W1qD1s0YktAFv4es= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:subject:from:to:references:message-id:date :mime-version:in-reply-to:content-type :content-transfer-encoding; s=default; bh=1NLDdWqqXkFinyhylDV0qA PrDTU=; b=v9UkFiuRoz/YF0nZi/AnRXtEzVjzgm3I4gZlRJt4w4PeCZPc+ptu8c BMSKuhFPl0jEPtS4sxWtlM9ENH0jXFBvVNViZJo8wyC52t34kuPws7k0t2fFXubl DWFI8SCmRy8+Naai3KncqKwO9tjmQaHxshd3vS6RIdytOo2uYxcVg= Received: (qmail 118575 invoked by alias); 12 Jul 2018 19:32:53 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Received: (qmail 118550 invoked by uid 89); 12 Jul 2018 19:32:52 -0000 Authentication-Results: sourceware.org; auth=none X-HELO: mail-ua0-f196.google.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=subject:from:to:references:openpgp:autocrypt:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=ZGRaR/y2y+ubbTSJ8DLOnq1fI1UzW+f+3htBHiHEBx4=; b=DvnPMv97heH9sFBWoe3N0jrJgW3zNAB3KxLb5Re2rqlYSop0y47+IXMHqjKIz25E4y Gd8QrdL7SsWqC35OHFKGwuZEkrw2XVXO6XX/Q0kkQ4/zZyj7ZA4oTfMvPjFyP6sdparT D6TqWuJJkoMj06/7k/amJDLs7asGgZGoZGTdI= Subject: Re: [PATCH v8 1/8] nptl: Add C11 threads thrd_* functions From: Adhemerval Zanella To: Florian Weimer , libc-alpha@sourceware.org References: <1517591084-11347-1-git-send-email-adhemerval.zanella@linaro.org> <1517591084-11347-2-git-send-email-adhemerval.zanella@linaro.org> Openpgp: preference=signencrypt Message-ID: <0cdb26a0-444c-3b42-f540-2bcf5ed393be@linaro.org> Date: Thu, 12 Jul 2018 16:32:45 -0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit On 12/07/2018 14:52, Adhemerval Zanella wrote: > > > On 12/07/2018 13:46, Florian Weimer wrote: >> On 02/02/2018 06:04 PM, Adhemerval Zanella wrote: >>> +int >>> +thrd_join (thrd_t thr, int *res) >>> +{ >>> +  void *pthread_res; >>> +  int err_code = __pthread_join (thr, &pthread_res); >>> +  if (res) >>> +   *res = (int)((uintptr_t) pthread_res); >>> + >>> +  return thrd_err_map (err_code); >>> +} >> >> Slight inconsistency with intptr_t above. > > Indeed, it seems there is no need to cast. In fact the cast this construction is still required, since the pthread_join returned value might have a different size of the expected c11 thrd_join. As a slight optimization I changed to int err_code = __pthread_timedjoin_ex (thr, &pthread_res, NULL, true); (it should avoid calling pthread_join which will in turn call pthread_timedjoin_ex).