πŸ’Ύ Archived View for gmi.noulin.net β€Ί man β€Ί man3 β€Ί pthread_attr_setsigmask_np.3.gmi captured on 2024-06-16 at 13:53:06. Gemini links have been rewritten to link to archived content

View Raw

More Information

⬅️ Previous capture (2023-09-08)

-=-=-=-=-=-=-

PTHREAD_ATTR_SETSIGMASK_NP(3)                                           Linux Programmer's Manual                                          PTHREAD_ATTR_SETSIGMASK_NP(3)

NAME
       pthread_attr_setsigmask_np, pthread_attr_getsigmask_np - set/get signal mask attribute in thread attributes object

SYNOPSIS
       #define _GNU_SOURCE             /* See feature_test_macros(7) */
       #include <pthread.h>

       int pthread_attr_setsigmask_np(pthread_attr_t *attr,
                                      const sigset_t *sigmask);
       int pthread_attr_getsigmask_np(const pthread_attr_t *attr,
                                      sigset_t *sigmask);

       Compile and link with -pthread.

DESCRIPTION
       The  pthread_attr_setsigmask_np() function sets the signal mask attribute of the thread attributes object referred to by attr to the value specified in *sigmask.
       If sigmask is specified as NULL, then any existing signal mask attribute in attr is unset.

       The pthread_attr_getsigmask_np() function returns the signal mask attribute of the thread attributes object referred to by attr in the buffer pointed to by  sig‐
       mask.  If the signal mask attribute is currently unset, then this function returns the special value PTHREAD_ATTR_NO_SIGMASK_NP as its result.

RETURN VALUE
       The pthread_attr_setsigmask_np() function returns 0 on success, or a nonzero error number on failure.

       the pthread_attr_getsigmask_np() function returns either 0 or PTHREAD_ATTR_NO_SIGMASK_NP.  When 0 is returned, the signal mask attribute is returned via sigmask.
       A return value of PTHREAD_ATTR_NO_SIGMASK_NP indicates that the signal mask attribute is not set in attr.

       On error, these functions return a positive error number.

ERRORS
       ENOMEM (pthread_attr_setsigmask_np()) Could not allocate memory.

VERSIONS
       These functions are provided by glibc since version 2.32.

ATTRIBUTES
       For an explanation of the terms used in this section, see attributes(7).

       β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
       β”‚Interface                                                                                                                             β”‚ Attribute     β”‚ Value   β”‚
       β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
       β”‚pthread_attr_setsigmask_np(), pthread_attr_getsigmask_np()                                                                            β”‚ Thread safety β”‚ MT-Safe β”‚
       β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

CONFORMING TO
       These functions are nonstandard GNU extensions; hence the suffix "_np" (nonportable) in the names.

NOTES
       The signal mask attribute determines the signal mask that will be assigned to a thread created using the thread attributes object attr.  If this attribute is not
       set, then a thread created using attr will inherit a copy of the creating thread's signal mask.

       For  more  details  on signal masks, see sigprocmask(2).  For a description of a set of macros that can be used to manipulate and inspect signal sets, see sigse‐
       tops(3).

       In the absence of pthread_attr_setsigmask_np() it is possible to create a thread with a desired signal mask as follows:

       β€’ The creating thread uses pthread_sigmask(3) to save its current signal mask and set its mask to block all signals.

       β€’ The new thread is then created using pthread_create(); the new thread will inherit the creating thread's signal mask.

       β€’ The new thread sets its signal mask to the desired value using pthread_sigmask(3).

       β€’ The creating thread restores its signal mask to the original value.

       Following the above steps, there is no possibility for the new thread to receive a signal before it has adjusted its signal mask to the desired value.

SEE ALSO
       sigprocmask(2), pthread_attr_init(3), pthread_sigmask(3), pthreads(7), signal(7)

Linux                                                                          2021-03-22                                                  PTHREAD_ATTR_SETSIGMASK_NP(3)