From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-Status: No, score=-4.1 required=3.0 tests=AWL,BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, SPF_HELO_PASS,SPF_PASS shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by dcvr.yhbt.net (Postfix) with ESMTPS id B55D61FA04 for ; Tue, 2 Jun 2020 04:05:41 +0000 (UTC) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id D94173840C38; Tue, 2 Jun 2020 04:05:40 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D94173840C38 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1591070740; bh=isXAqTQ22SXpTiqW6b1DMKc6HXR39UdZF6rTtbkkogg=; h=Subject:To:References:Date:In-Reply-To:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=d7Fl35ZtYMzqyH/Tqvp+25m5yxbTw4/E8G9q8oB8v4fSNGfDKyhubidDukYgY8r7U gm3YffaEhDjnu5ji/VeCHqwCfIscfldXAS1zoRLyg3VIjE0sQ+GvyT+yWZtjhu8bzD l5JQAp8fwH8siAScra95U4uDwTkg+ChhXODCGjog= Received: from us-smtp-delivery-1.mimecast.com (us-smtp-1.mimecast.com [207.211.31.81]) by sourceware.org (Postfix) with ESMTP id 2FEF23870852 for ; Tue, 2 Jun 2020 04:05:38 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 2FEF23870852 Received: from mail-qk1-f199.google.com (mail-qk1-f199.google.com [209.85.222.199]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-475-sU1YTSXgM1e0yzrwv679Uw-1; Tue, 02 Jun 2020 00:05:36 -0400 X-MC-Unique: sU1YTSXgM1e0yzrwv679Uw-1 Received: by mail-qk1-f199.google.com with SMTP id k2so4681435qke.3 for ; Mon, 01 Jun 2020 21:05:36 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:organization :message-id:date:user-agent:mime-version:in-reply-to :content-language:content-transfer-encoding; bh=isXAqTQ22SXpTiqW6b1DMKc6HXR39UdZF6rTtbkkogg=; b=W9VixNb6qLveXoF/tKe2kGlgaGDaErxso6mpVpNu2VuJpiBoQa8AVRbiC2wSyECbjj oRqQxVTVd62AMm1HAiRWT7NgBP+n21/YVDaD37fx4GwR6f9GIw3UjLCdQ3It5AgY3Z4b 60e2t9+ZSuPHXwjs3kpPTugPgtLs3duzliSIJf0KerHcv85pOBuTg6V2d3GBRECoxYys h8UTY+BDE+KSBb/jcQ3GDHBVdouk2ZqLcyHKWFrNwChUoJvVFSYNjYz4mChbLBHnBD+9 wgNOEOT15nLUDB3obbznQPrfZSVvjJmD3npGnJdjD/bNzbMr8wLBLgv4O06OIQtbu5XX C7JQ== X-Gm-Message-State: AOAM533c+YKcA0wHXIo9u2xorG0fWM4r70r4X/Prd/Bc69u360v+MPzf hq+fsGiHJVvwT/74lPfFVjn3sz0eC0wVQjfcfWOGdAQTN94s5VlwKnJnldLlgIA6W9cmm/JtSfA MMnkX2GQTIEUFNfJJ37px X-Received: by 2002:a05:620a:2153:: with SMTP id m19mr21805714qkm.1.1591070735804; Mon, 01 Jun 2020 21:05:35 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzNwq47mZXX2cBdlPPmiCi35pkmVnbomaCrg5RkjjauHD7b9iblvX5sEy4LpdHjJHZbt4F53Q== X-Received: by 2002:a05:620a:2153:: with SMTP id m19mr21805702qkm.1.1591070735517; Mon, 01 Jun 2020 21:05:35 -0700 (PDT) Received: from [192.168.1.4] (198-84-170-103.cpe.teksavvy.com. [198.84.170.103]) by smtp.gmail.com with ESMTPSA id f14sm1423042qka.70.2020.06.01.21.05.34 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 01 Jun 2020 21:05:34 -0700 (PDT) Subject: Re: [PATCH 18/19] manual: Add pthread_attr_setsigmask_np, pthread_attr_getsigmask_np To: Florian Weimer , libc-alpha@sourceware.org References: <4a7f25b6063cc41f13253953cf6cce8017c163c8.1589884403.git.fweimer@redhat.com> Organization: Red Hat Message-ID: Date: Tue, 2 Jun 2020 00:05:33 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.7.0 MIME-Version: 1.0 In-Reply-To: <4a7f25b6063cc41f13253953cf6cce8017c163c8.1589884403.git.fweimer@redhat.com> Content-Language: en-US X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Carlos O'Donell via Libc-alpha Reply-To: Carlos O'Donell Cc: "Michael Kerrisk \(man-pages\)" Errors-To: libc-alpha-bounces@sourceware.org Sender: "Libc-alpha" On 5/19/20 6:45 AM, Florian Weimer via Libc-alpha wrote: > And the PTHREAD_ATTR_NO_SIGMASK_NP constant. > --- > manual/threads.texi | 47 +++++++++++++++++++++++++++++++++++++++++++++ > 1 file changed, 47 insertions(+) > OK for master. Straight forward extension of the existing API and makes it easier to set the signal mask for the created thread in the attribute. The extension mechanism implemented for this should allow more flexible changes in the future. Reviewed-by: Carlos O'Donell > diff --git a/manual/threads.texi b/manual/threads.texi > index a425635179..28d7cf2abd 100644 > --- a/manual/threads.texi > +++ b/manual/threads.texi > @@ -625,6 +625,7 @@ the standard. > @menu > * Default Thread Attributes:: Setting default attributes for > threads in a process. > +* Initial Thread Signal Mask:: Setting the initial mask of threads. > * Waiting with Explicit Clocks:: Functions for waiting with an > explicit clock specification. > @end menu > @@ -671,6 +672,52 @@ The system does not have sufficient memory. > @end table > @end deftypefun > > +@node Initial Thread Signal Mask > +@subsubsection Controlling the Initial Signal Mask of a New Thread > + > +@Theglibc{} provides a way to specify the initial signal mask of a > +thread created using @code{pthread_create}, passing a thread attribute > +object configured for this purpose. > + > +These functions achieve the same effect as blocking all signals using > +@code{pthread_sigmask} before creating the thread, and setting the > +desired signal mask from the new thread, but in a more explicit > +fashion. > + > +@deftypefun int pthread_attr_setsigmask_np (pthread_attr_t *@var{attr}, const sigset_t *@var{sigmask}) > +@standards{GNU, pthread.h} > +@safety{@prelim{}@mtsafe{}@asunsafe{@ascuheap{}}@acunsafe{@acsmem{}}} > +Change the initial signal mask specified by @var{attr}. If > +@var{sigmask} is not @code{NULL}, the initial signal mask for new > +threads created with @var{attr} is set to @code{*@var{sigmask}}. If > +@var{sigmask} is @code{NULL}, @var{attr} will no longer specify an > +explicit signal mask, so that the initial signal mask of the new > +thread is inherited from the parent thread creating the new thread. OK. > + > +This function returns zero on success, and @code{ENOMEM} on memory > +allocation failure. OK. > +@end deftypefun > + > +@deftypefun int pthread_attr_getsigmask_np (const pthread_attr_t *@var{attr}, sigset_t *@var{sigmask}) > +@standards{GNU, pthread.h} > +@safety{@prelim{}@mtsafe{}@asunsafe{@ascuheap{}}@acunsafe{@acsmem{}}} > +Retrieve the initial signal mask stored in @var{attr} and write it ot > +@code{*@var{sigmask}}. If the signal mask has not been set, return > +the special constant @code{PTHREAD_ATTR_NO_SIGMASK_NP}, otherwise > +return zero. OK. > + > +Obtaining the signal mask only works if it has been previously stored > +by @code{pthread_attr_setsigmask_np}. For example, the > +@code{pthread_getattr_np} function does not obtain the current signal > +mask of the specified thread, and @code{pthread_attr_setsigmask_np} > +will subsequently report the signal mask as unset. > +@end deftypefun > + > +@deftypevr Macro int PTHREAD_ATTR_NO_SIGMASK_NP > +The special value returned by @code{pthread_attr_setsigmask_np} to > +indicate that no signal mask has been set for the attribute. OK. > +@end deftypevr > + > @node Waiting with Explicit Clocks > @subsubsection Functions for Waiting According to a Specific Clock > > -- Cheers, Carlos.