unofficial mirror of libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Florian Weimer via Libc-alpha <libc-alpha@sourceware.org>
To: libc-alpha@sourceware.org
Cc: "Michael Kerrisk \(man-pages\)" <mtk.manpages@gmail.com>
Subject: [PATCH 18/19] manual: Add pthread_attr_setsigmask_np, pthread_attr_getsigmask_np
Date: Tue, 19 May 2020 12:45:42 +0200	[thread overview]
Message-ID: <4a7f25b6063cc41f13253953cf6cce8017c163c8.1589884403.git.fweimer@redhat.com> (raw)
In-Reply-To: <cover.1589884403.git.fweimer@redhat.com>

And the PTHREAD_ATTR_NO_SIGMASK_NP constant.
---
 manual/threads.texi | 47 +++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 47 insertions(+)

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.
+
+This function returns zero on success, and @code{ENOMEM} on memory
+allocation failure.
+@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.
+
+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.
+@end deftypevr
+
 @node Waiting with Explicit Clocks
 @subsubsection Functions for Waiting According to a Specific Clock
 
-- 
2.25.4



  parent reply	other threads:[~2020-05-19 10:45 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-19 10:43 [PATCH 00/19] Signal mask for timer helper thread Florian Weimer via Libc-alpha
2020-05-19 10:44 ` [PATCH 01/19] manual: Add missing section and node for clockid_t wait functions Florian Weimer via Libc-alpha
2020-05-20 13:12   ` Carlos O'Donell via Libc-alpha
2020-05-19 10:44 ` [PATCH 02/19] nptl: Replace some stubs with the Linux implementation Florian Weimer via Libc-alpha
2020-05-20 13:27   ` Carlos O'Donell via Libc-alpha
2020-05-19 10:44 ` [PATCH 03/19] nptl: Move pthread_attr_setaffinity_np into libc Florian Weimer via Libc-alpha
2020-05-20 13:31   ` Carlos O'Donell via Libc-alpha
2020-05-19 10:44 ` [PATCH 04/19] nptl: Move pthread_getaffinity_np " Florian Weimer via Libc-alpha
2020-05-20 13:52   ` Carlos O'Donell via Libc-alpha
2020-05-19 10:44 ` [PATCH 05/19] nptl: Move pthread_gettattr_np " Florian Weimer via Libc-alpha
2020-05-20 13:57   ` Carlos O'Donell via Libc-alpha
2020-05-19 10:44 ` [PATCH 06/19] nptl: Make __pthread_attr_init, __pthread_attr_destroy available internally Florian Weimer via Libc-alpha
2020-05-20 13:59   ` Carlos O'Donell via Libc-alpha
2020-05-19 10:44 ` [PATCH 07/19] nptl: Add __pthread_attr_copy for copying pthread_attr_t objects Florian Weimer via Libc-alpha
2020-05-20 14:10   ` Carlos O'Donell via Libc-alpha
2020-05-19 10:44 ` [PATCH 08/19] nptl: Use __pthread_attr_copy in pthread_getattr_default_np (bug 25999) Florian Weimer via Libc-alpha
2020-05-20 14:42   ` Carlos O'Donell via Libc-alpha
2020-05-19 10:44 ` [PATCH 09/19] nptl: Use __pthread_attr_copy in pthread_setattr_default_np Florian Weimer via Libc-alpha
2020-05-20 14:48   ` Carlos O'Donell via Libc-alpha
2020-05-19 10:44 ` [PATCH 10/19] <libc-symbols.h>: Add libpthread hidden alias support Florian Weimer via Libc-alpha
2020-05-20 14:51   ` Carlos O'Donell via Libc-alpha
2020-05-19 10:44 ` [PATCH 11/19] nptl: Add internal alias __pthread_getattr_default_np Florian Weimer via Libc-alpha
2020-06-02  3:28   ` Carlos O'Donell via Libc-alpha
2020-05-19 10:44 ` [PATCH 12/19] nptl: Use __pthread_getattr_default_np in pthread_create Florian Weimer via Libc-alpha
2020-06-02  3:34   ` Carlos O'Donell via Libc-alpha
2020-05-19 10:44 ` [PATCH 13/19] nptl: Use __pthread_attr_setaffinity_np in pthread_getattr_np Florian Weimer via Libc-alpha
2020-06-02  3:36   ` Carlos O'Donell via Libc-alpha
2020-05-19 10:44 ` [PATCH 14/19] nptl: Change type of __default_pthread_attr Florian Weimer via Libc-alpha
2020-06-02  3:39   ` Carlos O'Donell via Libc-alpha
2020-05-19 10:44 ` [PATCH 15/19] nptl: Destroy the default thread attribute as part of freeres Florian Weimer via Libc-alpha
2020-06-02  3:41   ` Carlos O'Donell via Libc-alpha
2020-05-19 10:44 ` [PATCH 16/19] nptl: Make pthread_attr_t dynamically extensible Florian Weimer via Libc-alpha
2020-06-02  3:47   ` Carlos O'Donell via Libc-alpha
2020-05-19 10:44 ` [PATCH 17/19] nptl: Add pthread_attr_setsigmask_np, pthread_attr_getsigmask_np Florian Weimer via Libc-alpha
2020-06-02  4:01   ` Carlos O'Donell via Libc-alpha
2020-05-19 10:45 ` Florian Weimer via Libc-alpha [this message]
2020-05-20  7:39   ` [PATCH 18/19] manual: " Michael Kerrisk via Libc-alpha
2020-06-03  9:26     ` Florian Weimer via Libc-alpha
2020-06-02  4:05   ` Carlos O'Donell via Libc-alpha
2020-05-19 10:45 ` [PATCH 19/19] Linux: Use __pthread_attr_setsigmask_internal for timer helper thread Florian Weimer via Libc-alpha
2020-06-02  4:07   ` Carlos O'Donell via Libc-alpha
2020-05-20 13:11 ` [PATCH 00/19] Signal mask " Carlos O'Donell via Libc-alpha

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/libc/involved.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4a7f25b6063cc41f13253953cf6cce8017c163c8.1589884403.git.fweimer@redhat.com \
    --to=libc-alpha@sourceware.org \
    --cc=fweimer@redhat.com \
    --cc=mtk.manpages@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).