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=-2.4 required=3.0 tests=AWL,BAYES_00,BODY_8BITS, 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 6D7AD1F85E for ; Fri, 13 Jul 2018 12:59:11 +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:to:references:from:message-id:date :mime-version:in-reply-to:content-type :content-transfer-encoding; q=dns; s=default; b=ZKf2xvJglarfJ8Hw ypoz12ZGZD/TY/IGoVD2eBTP1pC6X4XR74M+ejmyPWrk9hliPob0zXh20uMt/zpV tt+YDHO46GGzXvf2Ih1OfLTEKz/vFp0Uj8cAODtCI/CltCgSlLM/UsTt4Zcq6YU6 CWIcmoNGpCDxWPG7QyT4fwlxCMs= 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:to:references:from:message-id:date :mime-version:in-reply-to:content-type :content-transfer-encoding; s=default; bh=95sSSYwZ9IUG1+6RshsuAo Kw84U=; b=C9iHAjBw9D0KOpGQKrUANqF2/A0R6KZ05iMPUY83uA3INUP+CeGPRi 8ZtRcnjwIeZ6vxBXf2AnwFlntI/lvo12GXByWnZoixwOlQhD9XbUT/ZJee7sJE8i OqDN32leDh6AGAobK5HEQ6HkRtcH0oktckYuGCnRQM+mx8i3klD3s= Received: (qmail 106126 invoked by alias); 13 Jul 2018 12:59:08 -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 105675 invoked by uid 89); 13 Jul 2018 12:59:07 -0000 Authentication-Results: sourceware.org; auth=none X-HELO: mail-vk0-f67.google.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=subject:to:references:from:openpgp:autocrypt:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=zIx6d1mduSDka9vDuoovCsYxBLFFV0GtzohYViXd454=; b=NmTKlIGCEBwhesF+MhC2AiJalN63I9sF0ff6phU0ZBjPFz3yrO9XPX179uVxam1QkQ M8vgV3Zi60xI0mG3WSxaUBiujkK7PnCiJqtT83JbcoaroNdZKptvBPf4qS6+ChTlHt17 NO5FUDDoRVgiQyGgY29VL6IdL6bQKeS7QYv14= Subject: Re: [PATCH v8 1/8] nptl: Add C11 threads thrd_* functions 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> <6bd3db7f-6fb5-8951-edc1-507fa93cb31a@redhat.com> From: Adhemerval Zanella Openpgp: preference=signencrypt Message-ID: Date: Fri, 13 Jul 2018 09:59:00 -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: <6bd3db7f-6fb5-8951-edc1-507fa93cb31a@redhat.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit On 13/07/2018 06:45, Florian Weimer wrote: > On 02/02/2018 06:04 PM, Adhemerval Zanella wrote: >>    2. thrd_sleep uses nanosleep internal direct syscall to avoid clobbering >>       errno, to handle expected standard return codes, and to avoid making >>       the call a POSIX cancellation entrypoint. > > Isn't this inconsistent with the conditional variable wait and thread join functions, which are still cancellation points? > > On the other hand, a sleep function which is not a cancellation point may be useful. I am not sure which would be the best option to handle POSIX cancellation with C11 threads with nptl implementation. Most straightforward option is just use cancellation entrypoints as default, even though using thread cancellation in C11 is UB (there is no defined way the use can get the POSIX thread id from a C11 thread). This don't require much internal code change Another option is just disable cancellation by using non-cancellable entry-points and/or explicit disable cancellation. For thrd_join is just a matter to set on '__pthread_timedjoin_ex', but for cnd_wait/cnd_timedwait we either need to explicit enable/disable or add an option to __pthread_cond_wait_common to select whether to use cancellable syscalls.