.\" -*- coding: UTF-8 -*- '\" t .\" Copyright (c) 2009 Linux Foundation, written by Michael Kerrisk .\" .\" .\" SPDX-License-Identifier: Linux-man-pages-copyleft .\" .\"******************************************************************* .\" .\" This file was generated with po4a. Translate the source file. .\" .\"******************************************************************* .TH pthread_sigmask 3 "20 juillet 2023" "Pages du manuel de Linux 6.05.01" .SH NOM pthread_sigmask \- Examiner et modifier le masque des signaux bloqués .SH BIBLIOTHÈQUE Bibliothèque de threads POSIX (\fIlibpthread\fP, \fI\-lpthread\fP) .SH SYNOPSIS .nf \fB#include \fP .PP \fBint pthread_sigmask(int \fP\fIhow\fP\fB, const sigset_t *\fP\fIset\fP\fB, sigset_t *\fP\fIoldset\fP\fB);\fP .fi .PP .RS -4 Exigences de macros de test de fonctionnalités pour la glibc (consulter \fBfeature_test_macros\fP(7))\ : .RE .PP \fBpthread_sigmask\fP()\ : .nf _POSIX_C_SOURCE >= 199506L || _XOPEN_SOURCE >= 500 .fi .SH DESCRIPTION La fonction \fBpthread_sigmask\fP() est identique à \fBsigprocmask\fP(2), à la différence près que son utilisation dans des programmes multithread est explicitement spécifié dans POSIX.1. D'autres différences sont indiquées dans cette page. .PP Pour une description des arguments et du mode d'opération de cette fonction, consultez \fBsigprocmask\fP(2). .SH "VALEUR RENVOYÉE" En cas de réussite, \fBpthread_sigmask\fP() renvoie 0\ ; en cas d'erreur, elle renvoie un numéro d'erreur. .SH ERREURS Consultez \fBsigprocmask\fP(2). .SH ATTRIBUTS Pour une explication des termes utilisés dans cette section, consulter \fBattributes\fP(7). .TS allbox; lbx lb lb l l l. Interface Attribut Valeur T{ .na .nh \fBpthread_sigmask\fP() T} Sécurité des threads MT\-Safe .TE .sp 1 .SH STANDARDS POSIX.1\-2008. .SH HISTORIQUE POSIX.1\-2001. .SH NOTES Un nouveau thread hérite d'une copie du masque de signaux de son créateur. .PP La fonction \fBpthread_sigmask\fP() de la glibc ignore silencieusement les tentatives de blocage des deux signaux en temps réel qui sont utilisés en interne par l'implémentation de threading de NPTL. Consultez \fBnptl\fP(7) pour des détails. .SH EXEMPLES Le programme ci\-dessous bloque certains signaux dans le thread principal, puis crée un thread dédié pour récupérer ces signaux avec \fBsigwait\fP(3). La session d'interpréteur de commande ci\-dessous démontre l'utilisation du programme. .PP .in +4n .EX $\fB ./a.out &\fP [1] 5423 $\fB kill \-QUIT %1\fP Signal handling thread got signal 3 $\fB kill \-USR1 %1\fP Signal handling thread got signal 10 $\fB kill \-TERM %1\fP [1]+ Terminated ./a.out .EE .in .SS "Source du programme" .\" SRC BEGIN (pthread_sigmask.c) \& .EX #include #include #include #include #include #include \& /* Simple error handling functions */ \& #define handle_error_en(en, msg) \e do { errno = en; perror(msg); exit(EXIT_FAILURE); } while (0) \& static void * sig_thread(void *arg) { sigset_t *set = arg; int s, sig; \& for (;;) { s = sigwait(set, &sig); if (s != 0) handle_error_en(s, "sigwait"); printf("Signal handling thread got signal %d\en", sig); } } \& int main(void) { pthread_t thread; sigset_t set; int s; \& /* Block SIGQUIT and SIGUSR1; other threads created by main() will inherit a copy of the signal mask. */ \& sigemptyset(&set); sigaddset(&set, SIGQUIT); sigaddset(&set, SIGUSR1); s = pthread_sigmask(SIG_BLOCK, &set, NULL); if (s != 0) handle_error_en(s, "pthread_sigmask"); \& s = pthread_create(&thread, NULL, &sig_thread, &set); if (s != 0) handle_error_en(s, "pthread_create"); \& /* Main thread carries on to create other threads and/or do other work. */ \& pause(); /* Dummy pause so we can test program */ } .EE .\" SRC END .SH "VOIR AUSSI" \fBsigaction\fP(2), \fBsigpending\fP(2), \fBsigprocmask\fP(2), \fBpthread_attr_setsigmask_np\fP(3), \fBpthread_create\fP(3), \fBpthread_kill\fP(3), \fBsigsetops\fP(3), \fBpthreads\fP(7), \fBsignal\fP(7) .PP .SH TRADUCTION La traduction française de cette page de manuel a été créée par Christophe Blaess , Stéphan Rafin , Thierry Vignaud , François Micaux, Alain Portal , Jean-Philippe Guérard , Jean-Luc Coulon (f5ibh) , Julien Cristau , Thomas Huriaux , Nicolas François , Florentin Duneau , Simon Paillard , Denis Barbier , David Prévot , Frédéric Hantrais et Jean-Pierre Giraud . .PP Cette traduction est une documentation libre ; veuillez vous reporter à la .UR https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License version 3 .UE concernant les conditions de copie et de distribution. Il n'y a aucune RESPONSABILITÉ LÉGALE. .PP Si vous découvrez un bogue dans la traduction de cette page de manuel, veuillez envoyer un message à .MT debian-l10n-french@lists.debian.org .ME .