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 EB8501F85E for ; Thu, 12 Jul 2018 20:30:40 +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=r+uVN5CIP7xQaPsF 8nRy1XRZXaGR19CDqIydsYhfRlXE4qlAk9hs4XFlpUGoIZVVf6KPGB6+Oi5Ks8+h vsGhvF/HGNdjwxT2SE5+xpMigtQqaaxbZRu3ezs24UZsxe74ZQZwN0acKgjPc/MK iXXWsOpmRjNjrcarXMJ6XxEzOCg= 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=XRaZMvThcxBjto9nwtXN2f MH1JQ=; b=l07bpoVrUhMVRL5mxfmTNNrDLobivX4qC6zK4zW9O3RlFA7uZ3rxAG offmTOh68MQAxqHjvlT4euV9TtvhWtZD6/BVKlykn8e2ac5UFPkJdE0yWLINhdn3 bMBYLO7orKzZ59bwGURcCvU4TRYcLMIkrp5blSjcnlhyvAiMbdkUU= Received: (qmail 86330 invoked by alias); 12 Jul 2018 20:30:37 -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 85744 invoked by uid 89); 12 Jul 2018 20:30:26 -0000 Authentication-Results: sourceware.org; auth=none X-HELO: mail-ua0-f195.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=1Ej51XcPzhtE/9J+Sh/aPbPdI5tY/MFlxa18Ym9GAxs=; b=A0BULQ66e02SOTGXAkY+Dd3av4DdcbBwI+4jvwjPePbAFmrmxOu4NDDr0/ruyDeyZQ ruNJFoYbmcC8dWFYsdDJABOEGGuDLUrL+jz9VG1c3nLW6rPSy3e+k+/yRvldPDWjWWLR P4WOw/Q3sEBR0UAlFfoDIbKdDh+OttycW14co= Subject: Re: [PATCH v8 2/8] nptl: Add C11 threads mtx_* functions To: Florian Weimer , libc-alpha@sourceware.org References: <1517591084-11347-1-git-send-email-adhemerval.zanella@linaro.org> <1517591084-11347-3-git-send-email-adhemerval.zanella@linaro.org> <44460c52-bff8-d7a7-4d7e-f017ad268c21@redhat.com> <4be08a33-8957-0494-857b-5c26869778b1@linaro.org> From: Adhemerval Zanella Openpgp: preference=signencrypt Message-ID: <148abea8-72ba-e474-c0ac-251a546717cf@linaro.org> Date: Thu, 12 Jul 2018 17:30:18 -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 15:39, Florian Weimer wrote: > On 07/10/2018 02:35 PM, Adhemerval Zanella wrote: >> >> >> On 06/07/2018 09:51, Florian Weimer wrote: >>> On 02/02/2018 06:04 PM, Adhemerval Zanella wrote: >>>> This patch adds the mtx_* definitions from C11 threads (ISO/IEC 9899:2011), >>>> more specifically mtx_init, mtx_destroy, mtx_lock, mtx_timedlock, mtx_trylock, >>>> mtx_unlock, and required types. >>>> >>>> Mostly of the definitions are composed based on POSIX conterparts, and mtx_t >>>> is also based on internal pthread fields, but with a distinct internal layout >>>> to avoid possible issues with code interchange (such as trying to pass POSIX >>>> structure on C11 functions and to avoid inclusion of pthread.h).  The idea >>>> is to make possible to share POSIX internal implementations for mostly of >>>> the code (and making adjustment only when required). >>> >>> Should we check for the supported mutex types and error out if the type does not match?  The interface does not support the full range of error codes required by robust mutexes, for example—EOWNERDEAD is missing. >>> >> >> I am not sure if adding extra tests will yield any gain, specially on mutex >> operations which users would expect optimized fast paths.  I really think >> we should handle as undefined behaviour if uses try to use pthread_t objects >> with c11 threads function (in similar manner it is undefined behaviour if >> uses messes with internal pthread_mutex_t objects data directly). > > Some people might be tempted to use the C11 interfaces to avoid the (formal) namespace violations of the POSIX functions, but still stick to the underlying POSIX objects for type compatibility on other interfaces. > > But I think we can clearly document that they shouldn't do this. Even if developers try to do this, it will be implementation specific (in a sense an implementation may provide different underlying types for POSIX and C11 thread objects). I really think we should explicit this is a non-supported scenario. > > I'm concerned about this because in the future, we might compile the implementations to remove checks that are not needed for the C11 implementations. Why kind of scenario do you have in mind? Maybe use a more streamlined internal implementation for C11 threads?