1
0
mirror of https://sourceware.org/git/glibc.git synced 2025-07-29 11:41:21 +03:00

nptl: Add pthread_attr_setsigmask_np, pthread_attr_getsigmask_np

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
Tested-by: Carlos O'Donell <carlos@redhat.com>
This commit is contained in:
Florian Weimer
2020-06-02 10:34:55 +02:00
parent 7538d46113
commit ec41af45a6
42 changed files with 441 additions and 7 deletions

View File

@ -745,14 +745,23 @@ __pthread_create_2_1 (pthread_t *newthread, const pthread_attr_t *attr,
sigset_t original_sigmask;
__libc_signal_block_all (&original_sigmask);
/* Conceptually, the new thread needs to inherit the signal mask of
this thread. Therefore, it needs to restore the saved signal
mask of this thread, so save it in the startup information. */
pd->sigmask = original_sigmask;
if (iattr->extension != NULL && iattr->extension->sigmask_set)
/* Use the signal mask in the attribute. The internal signals
have already been filtered by the public
pthread_attr_setsigmask_np interface. */
pd->sigmask = iattr->extension->sigmask;
else
{
/* Conceptually, the new thread needs to inherit the signal mask
of this thread. Therefore, it needs to restore the saved
signal mask of this thread, so save it in the startup
information. */
pd->sigmask = original_sigmask;
/* Reset the cancellation signal mask in case this thread is running
cancellation. */
__sigdelset (&pd->sigmask, SIGCANCEL);
/* Reset the cancellation signal mask in case this thread is
running cancellation. */
__sigdelset (&pd->sigmask, SIGCANCEL);
}
/* Start the thread. */
if (__glibc_unlikely (report_thread_creation (pd)))