# French translation of manpages # This file is distributed under the same license as the manpages-l10n package. # Copyright © of this file: # Christophe Blaess , 1996-2003. # Stéphan Rafin , 2002. # Thierry Vignaud , 1999, 2002. # François Micaux, 2002. # Alain Portal , 2003-2008. # Jean-Philippe Guérard , 2005-2006. # Jean-Luc Coulon (f5ibh) , 2006-2007. # Julien Cristau , 2006-2007. # Thomas Huriaux , 2006-2008. # Nicolas François , 2006-2008. # Florentin Duneau , 2006-2010. # Simon Paillard , 2006. # Denis Barbier , 2006, 2010. # David Prévot , 2010, 2012. # Frédéric Hantrais , 2013, 2014. # Jean-Pierre Giraud , 2023-2024. msgid "" msgstr "" "Project-Id-Version: manpages-l10n 4.22.0\n" "POT-Creation-Date: 2024-06-01 06:13+0200\n" "PO-Revision-Date: 2024-06-03 11:48+0200\n" "Last-Translator: Jean-Pierre Giraud \n" "Language-Team: French \n" "Language: fr\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=n > 1;\n" "X-Generator: Lokalize 22.12.3\n" #. type: TH #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed #, no-wrap msgid "pthread_create" msgstr "pthread_create" #. type: TH #: archlinux debian-unstable opensuse-tumbleweed #, no-wrap msgid "2024-05-02" msgstr "2 mai 2024" #. type: TH #: archlinux debian-unstable #, no-wrap msgid "Linux man-pages 6.8" msgstr "Pages du manuel de Linux 6.8" #. type: SH #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed #, no-wrap msgid "NAME" msgstr "NOM" #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "pthread_create - create a new thread" msgstr "pthread_create – Créer un nouveau thread" #. type: SH #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed #, no-wrap msgid "LIBRARY" msgstr "BIBLIOTHÈQUE" #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "POSIX threads library (I, I<-lpthread>)" msgstr "Bibliothèque de threads POSIX (I, I<-lpthread>)" #. type: SH #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed #, no-wrap msgid "SYNOPSIS" msgstr "SYNOPSIS" #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed #, no-wrap msgid "B<#include Epthread.hE>\n" msgstr "B<#include Epthread.hE>\n" #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed #, no-wrap msgid "" "BIB<,>\n" "B< const pthread_attr_t *restrict >IB<,>\n" "B< void *(*>IB<)(void *),>\n" "B< void *restrict >IB<);>\n" msgstr "" "BIB<,>\n" "B< const pthread_attr_t *restrict >IB<,>\n" "B< void *(*>IB<)(void *),>\n" "B< void *restrict >IB<);>\n" #. type: SH #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed #, no-wrap msgid "DESCRIPTION" msgstr "DESCRIPTION" #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "" "The B() function starts a new thread in the calling " "process. The new thread starts execution by invoking I(); " "I is passed as the sole argument of I()." msgstr "" "La fonction B() démarre un nouveau thread (processus léger) " "dans le processus appelant. Le nouveau thread commence par appeler " "I()\\ ; I est passé comme unique argument de " "I()." #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "The new thread terminates in one of the following ways:" msgstr "Le nouveau thread se termine d'une des manières suivantes\\ :" #. type: IP #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed #, no-wrap msgid "\\[bu]" msgstr "-" #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "" "It calls B(3), specifying an exit status value that is " "available to another thread in the same process that calls " "B(3)." msgstr "" "Il appelle B(3), en indiquant une valeur de sortie qui sera " "disponible pour un autre thread du même processus qui appelle " "B(3)." #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "" "It returns from I(). This is equivalent to calling " "B(3) with the value supplied in the I statement." msgstr "" "Il sort de la routine I(). C'est équivalent à appeler " "B(3) avec la valeur fournie à l'instruction I." #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "It is canceled (see B(3))." msgstr "Il est annulé (voir B(3))." #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "" "Any of the threads in the process calls B(3), or the main thread " "performs a return from I
(). This causes the termination of all " "threads in the process." msgstr "" "Un des threads du processus appelle B(3) ou le thread principal sort " "de la routine I
() ce qui entraîne l'arrêt de tous les threads du " "processus." #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "" "The I argument points to a I structure whose contents " "are used at thread creation time to determine attributes for the new thread; " "this structure is initialized using B(3) and related " "functions. If I is NULL, then the thread is created with default " "attributes." msgstr "" "L'argument I pointe sur une structure I dont le " "contenu est utilisé pendant la création des threads pour déterminer les " "attributs du nouveau thread. Cette structure est initialisée avec " "B(3) et les fonctions similaires. Si I est NULL, " "alors le thread est créé avec les attributs par défaut." #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "" "Before returning, a successful call to B() stores the ID of " "the new thread in the buffer pointed to by I; this identifier is " "used to refer to the thread in subsequent calls to other pthreads functions." msgstr "" "Avant de rendre la main, un appel réussi à B() stocke " "l'identifiant du nouveau thread dans le tampon pointé par I. Cet " "identifiant est utilisé pour se référer à ce thread dans les appels " "ultérieurs aux autres fonctions de pthreads." #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "" "The new thread inherits a copy of the creating thread's signal mask " "(B(3)). The set of pending signals for the new thread is " "empty (B(2)). The new thread does not inherit the creating " "thread's alternate signal stack (B(2))." msgstr "" "Le nouveau thread hérite d'une copie du masque de signal du thread créateur " "(B(3)). L'ensemble des signaux en attente pour le nouveau " "thread est vide (B(2)). Le nouveau thread n'hérite pas de la " "pile spécifique de signaux (B(2)) du thread appelant." #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "" "The new thread inherits the calling thread's floating-point environment " "(B(3))." msgstr "" "Le nouveau thread hérite de l'environnement en virgule flottante " "(B(3)) du thread appelant." #. CLOCK_THREAD_CPUTIME_ID in clock_gettime(2) #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "" "The initial value of the new thread's CPU-time clock is 0 (see " "B(3))." msgstr "" "La valeur initiale de l'horloge CPU du nouveau thread est 0 (voir " "B(3))." #. type: SS #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed #, no-wrap msgid "Linux-specific details" msgstr "Détails spécifiques à Linux" #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "" "The new thread inherits copies of the calling thread's capability sets (see " "B(7)) and CPU affinity mask (see B(2))." msgstr "" "Le nouveau thread hérite de copies des ensembles des capacités (voir " "B(7)) et des masques d'affinité CPU (consultez " "B(2)) du thread appelant." #. type: SH #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed #, no-wrap msgid "RETURN VALUE" msgstr "VALEUR RENVOYÉE" #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "" "On success, B() returns 0; on error, it returns an error " "number, and the contents of I<*thread> are undefined." msgstr "" "En cas de réussite, B() renvoie B<0> ; en cas d'erreur, elle " "renvoie un numéro d'erreur, et le contenu de I<*thread> est indéfini." #. type: SH #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed #, no-wrap msgid "ERRORS" msgstr "ERREURS" #. type: TP #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed #, no-wrap msgid "B" msgstr "B" #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "Insufficient resources to create another thread." msgstr "Ressources insuffisantes pour créer un nouveau thread." #. NOTE! The following should match the description in fork(2) #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "" "A system-imposed limit on the number of threads was encountered. There are " "a number of limits that may trigger this error: the B soft " "resource limit (set via B(2)), which limits the number of " "processes and threads for a real user ID, was reached; the kernel's system-" "wide limit on the number of processes and threads, I, was reached (see B(5)); or the maximum number of PIDs, " "I, was reached (see B(5))." msgstr "" "Une limite système sur le nombre de threads a été atteinte. Plusieurs " "limites pourraient déclencher cette erreur : la limite de ressources souple " "B (définie à l’aide B(2)), qui limite le nombre de " "processus et threads par identifiant d’utilisateur réel, a été atteinte ; " "la limite système imposée par le noyau sur le nombre total de processus et " "threads, I, a été atteinte (consultez " "B(5)) ; ou le nombre maximal de PID, I, a " "été atteint (consultez B(5))." #. type: TP #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed #, no-wrap msgid "B" msgstr "B" #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "Invalid settings in I." msgstr "Paramètres incorrects dans I." #. FIXME . Test the following #. type: TP #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed #, no-wrap msgid "B" msgstr "B" #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "" "No permission to set the scheduling policy and parameters specified in " "I." msgstr "" "Permissions insuffisantes pour définir la politique d'ordonnancement et les " "paramètres spécifiés dans I." #. type: SH #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed #, no-wrap msgid "ATTRIBUTES" msgstr "ATTRIBUTS" #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "" "For an explanation of the terms used in this section, see B(7)." msgstr "" "Pour une explication des termes utilisés dans cette section, consulter " "B(7)." #. type: tbl table #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed #, no-wrap msgid "Interface" msgstr "Interface" #. type: tbl table #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed #, no-wrap msgid "Attribute" msgstr "Attribut" #. type: tbl table #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed #, no-wrap msgid "Value" msgstr "Valeur" #. type: tbl table #: archlinux debian-unstable fedora-40 fedora-rawhide mageia-cauldron #: opensuse-tumbleweed #, no-wrap msgid ".na\n" msgstr ".na\n" #. type: tbl table #: archlinux debian-unstable fedora-40 fedora-rawhide mageia-cauldron #: opensuse-tumbleweed #, no-wrap msgid ".nh\n" msgstr ".nh\n" #. type: tbl table #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed #, no-wrap msgid "B()" msgstr "B()" #. type: tbl table #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed #, no-wrap msgid "Thread safety" msgstr "Sécurité des threads" #. type: tbl table #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed #, no-wrap msgid "MT-Safe" msgstr "MT-Safe" #. type: SH #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed #, no-wrap msgid "STANDARDS" msgstr "STANDARDS" #. type: Plain text #: archlinux debian-unstable fedora-40 fedora-rawhide mageia-cauldron #: opensuse-leap-15-6 opensuse-tumbleweed msgid "POSIX.1-2008." msgstr "POSIX.1-2008." #. type: SH #: archlinux debian-unstable fedora-40 fedora-rawhide mageia-cauldron #: opensuse-leap-15-6 opensuse-tumbleweed #, no-wrap msgid "HISTORY" msgstr "HISTORIQUE" #. type: Plain text #: archlinux debian-unstable fedora-40 fedora-rawhide mageia-cauldron #: opensuse-leap-15-6 opensuse-tumbleweed msgid "POSIX.1-2001." msgstr "POSIX.1-2001." #. type: SH #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed #, no-wrap msgid "NOTES" msgstr "NOTES" #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "" "See B(3) for further information on the thread ID returned in " "I<*thread> by B(). Unless real-time scheduling policies are " "being employed, after a call to B(), it is indeterminate " "which thread\\[em]the caller or the new thread\\[em]will next execute." msgstr "" "Consultez B(3) pour des informations plus détaillées sur " "l'identifiant de thread renvoyé dans I<*thread> par B(). " "Sauf si une politique d'ordonnancement temps-réel est employée, après un " "appel à B(), on ne sait pas quel thread \\[em] l'appelant ou " "le nouveau thread \\[em] sera exécuté ensuite." #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "" "A thread may either be I or I. If a thread is joinable, " "then another thread can call B(3) to wait for the thread to " "terminate and fetch its exit status. Only when a terminated joinable thread " "has been joined are the last of its resources released back to the system. " "When a detached thread terminates, its resources are automatically released " "back to the system: it is not possible to join with the thread in order to " "obtain its exit status. Making a thread detached is useful for some types " "of daemon threads whose exit status the application does not need to care " "about. By default, a new thread is created in a joinable state, unless " "I was set to create the thread in a detached state (using " "B(3))." msgstr "" "Un thread peut être dans un état soit joignable (I), soit détaché " "(I). Si un thread est joignable, un autre thread peut appeler " "B(3) pour attendre que ce thread se termine et récupérer sa " "valeur de sortie. Ce n'est que quand un thread terminé et joignable a été " "joint que ses ressources sont rendues au système. Quand un thread détaché se " "termine, ses ressources sont automatiquement rendues au système\\ : il n'est " "pas possible de joindre un tel thread afin d'en obtenir la valeur de sortie. " "Mettre un thread dans l'état détaché est pratique pour certains types de " "threads de démon dont l'application n'a pas à se préoccuper de la valeur de " "sortie. Par défaut, un nouveau thread est créé dans l'état joignable, à " "moins qu'I n'ait été modifié (avec B(3)) " "pour créer le thread dans un état détaché." #. type: Plain text #: archlinux debian-unstable fedora-40 fedora-rawhide mageia-cauldron #: opensuse-tumbleweed msgid "" "Under the NPTL threading implementation, if the B soft " "resource limit I has any value other than " "\"unlimited\", then it determines the default stack size of new threads. " "Using B(3), the stack size attribute can be " "explicitly set in the I argument used to create a thread, in order to " "obtain a stack size other than the default. If the B resource " "limit is set to \"unlimited\", a per-architecture value is used for the " "stack size: 2 MB on most architectures; 4 MB on POWER and Sparc-64." msgstr "" "Avec l'implémentation NPTL, si la limite souple B a une valeur " "autre qu'«\\ unlimited\\ » I, elle " "détermine la taille de la pile par défaut pour les nouveaux threads. Afin " "d'obtenir une taille de pile différente de la valeur par défaut, il faut " "appeler B(3) avec la valeur souhaitée sur " "l'argument I utilisé pour créer un thread. Si la limite de ressources " "B a la valeur «\\ unlimited\\ », une valeur dépendant de " "l'architecture est utilisée pour la taille de la pile : 2 Mo pour la plupart " "des architectures ; 4 Mo pour POWER et Sparc-64." #. type: SH #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed #, no-wrap msgid "BUGS" msgstr "BOGUES" #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "" "In the obsolete LinuxThreads implementation, each of the threads in a " "process has a different process ID. This is in violation of the POSIX " "threads specification, and is the source of many other nonconformances to " "the standard; see B(7)." msgstr "" "Dans l'implémentation obsolète LinuxThreads, chacun des threads dans un " "processus a un identifiant de processus différent, ce qui est en violation " "des spécifications POSIX sur les threads et est la cause de nombreuses non-" "conformité au standard. Consultez B(7)." #. type: SH #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed #, no-wrap msgid "EXAMPLES" msgstr "EXEMPLES" #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "" "The program below demonstrates the use of B(), as well as a " "number of other functions in the pthreads API." msgstr "" "Le programme ci-dessous montre l'utilisation de B(), ainsi " "qu'un certain nombre d'autres fonctions de l'API pthreads." #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "" "In the following run, on a system providing the NPTL threading " "implementation, the stack size defaults to the value given by the \"stack " "size\" resource limit:" msgstr "" "Lors de l'exécution suivante, sur un système avec l'implémentation NPTL, la " "taille de la pile vaut par défaut la valeur renvoyée par la limite de la " "ressource «\\ stack size\\ » (taille de la pile)\\ :" #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed #, no-wrap msgid "" "$B< ulimit -s>\n" "8192 # The stack size limit is 8 MB (0x800000 bytes)\n" "$B< ./a.out hola salut servus>\n" "Thread 1: top of stack near 0xb7dd03b8; argv_string=hola\n" "Thread 2: top of stack near 0xb75cf3b8; argv_string=salut\n" "Thread 3: top of stack near 0xb6dce3b8; argv_string=servus\n" "Joined with thread 1; returned value was HOLA\n" "Joined with thread 2; returned value was SALUT\n" "Joined with thread 3; returned value was SERVUS\n" msgstr "" "$B< ulimit -s>\n" "8192 # The stack size limit is 8 MB (0x800000 bytes)\n" "$B< ./a.out hola salut servus>\n" "Thread 1: top of stack near 0xb7dd03b8; argv_string=hola\n" "Thread 2: top of stack near 0xb75cf3b8; argv_string=salut\n" "Thread 3: top of stack near 0xb6dce3b8; argv_string=servus\n" "Joined with thread 1; returned value was HOLA\n" "Joined with thread 2; returned value was SALUT\n" "Joined with thread 3; returned value was SERVUS\n" #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "" "In the next run, the program explicitly sets a stack size of 1\\ MB (using " "B(3)) for the created threads:" msgstr "" "Lors de l'exécution suivante, le programme définit explicitement une taille " "de pile de 1\\ Mo (avec B(3)) pour les threads " "créés\\ :" #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed #, no-wrap msgid "" "$B< ./a.out -s 0x100000 hola salut servus>\n" "Thread 1: top of stack near 0xb7d723b8; argv_string=hola\n" "Thread 2: top of stack near 0xb7c713b8; argv_string=salut\n" "Thread 3: top of stack near 0xb7b703b8; argv_string=servus\n" "Joined with thread 1; returned value was HOLA\n" "Joined with thread 2; returned value was SALUT\n" "Joined with thread 3; returned value was SERVUS\n" msgstr "" "$B< ./a.out -s 0x100000 hola salut servus>\n" "Thread 1: top of stack near 0xb7d723b8; argv_string=hola\n" "Thread 2: top of stack near 0xb7c713b8; argv_string=salut\n" "Thread 3: top of stack near 0xb7b703b8; argv_string=servus\n" "Joined with thread 1; returned value was HOLA\n" "Joined with thread 2; returned value was SALUT\n" "Joined with thread 3; returned value was SERVUS\n" #. type: SS #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed #, no-wrap msgid "Program source" msgstr "Source du programme" #. type: Plain text #: archlinux debian-unstable opensuse-tumbleweed #, no-wrap msgid "" "#include Ectype.hE\n" "#include Eerrno.hE\n" "#include Epthread.hE\n" "#include Estdio.hE\n" "#include Estdlib.hE\n" "#include Estring.hE\n" "#include Esys/types.hE\n" "#include Eunistd.hE\n" "\\&\n" "#define handle_error_en(en, msg) \\e\n" " do { errno = en; perror(msg); exit(EXIT_FAILURE); } while (0)\n" "\\&\n" "#define handle_error(msg) \\e\n" " do { perror(msg); exit(EXIT_FAILURE); } while (0)\n" "\\&\n" "struct thread_info { /* Used as argument to thread_start() */\n" " pthread_t thread_id; /* ID returned by pthread_create() */\n" " int thread_num; /* Application-defined thread # */\n" " char *argv_string; /* From command-line argument */\n" "};\n" "\\&\n" "/* Thread start function: display address near top of our stack,\n" " and return upper-cased copy of argv_string. */\n" "\\&\n" "static void *\n" "thread_start(void *arg)\n" "{\n" " struct thread_info *tinfo = arg;\n" " char *uargv;\n" "\\&\n" " printf(\"Thread %d: top of stack near %p; argv_string=%s\\en\",\n" " tinfo-Ethread_num, (void *) &tinfo, tinfo-Eargv_string);\n" "\\&\n" " uargv = strdup(tinfo-Eargv_string);\n" " if (uargv == NULL)\n" " handle_error(\"strdup\");\n" "\\&\n" " for (char *p = uargv; *p != \\[aq]\\e0\\[aq]; p++)\n" " *p = toupper(*p);\n" "\\&\n" " return uargv;\n" "}\n" "\\&\n" "int\n" "main(int argc, char *argv[])\n" "{\n" " int s, opt;\n" " void *res;\n" " size_t num_threads;\n" " ssize_t stack_size;\n" " pthread_attr_t attr;\n" " struct thread_info *tinfo;\n" "\\&\n" " /* The \"-s\" option specifies a stack size for our threads. */\n" "\\&\n" " stack_size = -1;\n" " while ((opt = getopt(argc, argv, \"s:\")) != -1) {\n" " switch (opt) {\n" " case \\[aq]s\\[aq]:\n" " stack_size = strtoul(optarg, NULL, 0);\n" " break;\n" "\\&\n" " default:\n" " fprintf(stderr, \"Usage: %s [-s stack-size] arg...\\en\",\n" " argv[0]);\n" " exit(EXIT_FAILURE);\n" " }\n" " }\n" "\\&\n" " num_threads = argc - optind;\n" "\\&\n" " /* Initialize thread creation attributes. */\n" "\\&\n" " s = pthread_attr_init(&attr);\n" " if (s != 0)\n" " handle_error_en(s, \"pthread_attr_init\");\n" "\\&\n" " if (stack_size E 0) {\n" " s = pthread_attr_setstacksize(&attr, stack_size);\n" " if (s != 0)\n" " handle_error_en(s, \"pthread_attr_setstacksize\");\n" " }\n" "\\&\n" " /* Allocate memory for pthread_create() arguments. */\n" "\\&\n" " tinfo = calloc(num_threads, sizeof(*tinfo));\n" " if (tinfo == NULL)\n" " handle_error(\"calloc\");\n" "\\&\n" " /* Create one thread for each command-line argument. */\n" "\\&\n" " for (size_t tnum = 0; tnum E num_threads; tnum++) {\n" " tinfo[tnum].thread_num = tnum + 1;\n" " tinfo[tnum].argv_string = argv[optind + tnum];\n" "\\&\n" " /* The pthread_create() call stores the thread ID into\n" " corresponding element of tinfo[]. */\n" "\\&\n" " s = pthread_create(&tinfo[tnum].thread_id, &attr,\n" " &thread_start, &tinfo[tnum]);\n" " if (s != 0)\n" " handle_error_en(s, \"pthread_create\");\n" " }\n" "\\&\n" " /* Destroy the thread attributes object, since it is no\n" " longer needed. */\n" "\\&\n" " s = pthread_attr_destroy(&attr);\n" " if (s != 0)\n" " handle_error_en(s, \"pthread_attr_destroy\");\n" "\\&\n" " /* Now join with each thread, and display its returned value. */\n" "\\&\n" " for (size_t tnum = 0; tnum E num_threads; tnum++) {\n" " s = pthread_join(tinfo[tnum].thread_id, &res);\n" " if (s != 0)\n" " handle_error_en(s, \"pthread_join\");\n" "\\&\n" " printf(\"Joined with thread %d; returned value was %s\\en\",\n" " tinfo[tnum].thread_num, (char *) res);\n" " free(res); /* Free memory allocated by thread */\n" " }\n" "\\&\n" " free(tinfo);\n" " exit(EXIT_SUCCESS);\n" "}\n" msgstr "" "#include Ectype.hE\n" "#include Eerrno.hE\n" "#include Epthread.hE\n" "#include Estdio.hE\n" "#include Estdlib.hE\n" "#include Estring.hE\n" "#include Esys/types.hE\n" "#include Eunistd.hE\n" "\\&\n" "#define handle_error_en(en, msg) \\e\n" " do { errno = en; perror(msg); exit(EXIT_FAILURE); } while (0)\n" "\\&\n" "#define handle_error(msg) \\e\n" " do { perror(msg); exit(EXIT_FAILURE); } while (0)\n" "\\&\n" "struct thread_info { /* Utilisé comme argument pour thread_start() */\n" " pthread_t thread_id; /* Identifiant renvoyé par pthread_create() */\n" " int thread_num; /* N° de thread défini par l'application */\n" " char *argv_string; /* À partir de l'argument en ligne de commande */\n" "};\n" "\\&\n" "/* Fonction de démarrage du thread : affiche l'adresse vers le haut de la pile,\n" " et renvoie une copie en majuscule de argv_string. */\n" "\\&\n" "static void *\n" "thread_start(void *arg)\n" "{\n" " struct thread_info *tinfo = arg;\n" " char *uargv;\n" "\\&\n" " printf(\"Thread %d : sommet de la pile près de %p; argv_string=%s\\en\",\n" " tinfo-Ethread_num, (void *) &tinfo, tinfo-Eargv_string);\n" "\\&\n" " uargv = strdup(tinfo-Eargv_string);\n" " if (uargv == NULL)\n" " handle_error(\"strdup\");\n" "\\&\n" " for (char *p = uargv; *p != \\[aq]\\e0\\[aq]; p++)\n" " *p = toupper(*p);\n" "\\&\n" " return uargv;\n" "}\n" "\\&\n" "int\n" "main(int argc, char *argv[])\n" "{\n" " int s, opt;\n" " void *res;\n" " size_t num_threads;\n" " ssize_t stack_size;\n" " pthread_attr_t attr;\n" " struct thread_info *tinfo;\n" "\\&\n" " /* L'option \"-s\" spécifie une taille de pile pour les threads. */\n" "\\&\n" " stack_size = -1;\n" " while ((opt = getopt(argc, argv, \"s:\")) != -1) {\n" " switch (opt) {\n" " case \\[aq]s\\[aq]:\n" " stack_size = strtoul(optarg, NULL, 0);\n" " break;\n" "\\&\n" " default:\n" " fprintf(stderr, \"Usage : %s [-s stack-size] arg...\\en\",\n" " argv[0]);\n" " exit(EXIT_FAILURE);\n" " }\n" " }\n" "\\&\n" " num_threads = argc - optind;\n" "\\&\n" " /* Initialiser les attributs de création de thread. */\n" "\\&\n" " s = pthread_attr_init(&attr);\n" " if (s != 0)\n" " handle_error_en(s, \"pthread_attr_init\");\n" "\\&\n" " if (stack_size E 0) {\n" " s = pthread_attr_setstacksize(&attr, stack_size);\n" " if (s != 0)\n" " handle_error_en(s, \"pthread_attr_setstacksize\");\n" " }\n" "\\&\n" " /* Allouer la mémoire pour les arguments de pthread_create(). */\n" "\\&\n" " tinfo = calloc(num_threads, sizeof(*tinfo));\n" " if (tinfo == NULL)\n" " handle_error(\"calloc\");\n" "\\&\n" " /* Créer un thread pour chaque argument en ligne de commande. */\n" "\\&\n" " for (size_t tnum = 0; tnum E num_threads; tnum++) {\n" " tinfo[tnum].thread_num = tnum + 1;\n" " tinfo[tnum].argv_string = argv[optind + tnum];\n" "\\&\n" " /* L'appel pthread_create() stocke l'identifiant du thread dans\n" " l'élément correspondant de tinfo[]. */\n" "\\&\n" " s = pthread_create(&tinfo[tnum].thread_id, &attr,\n" " &thread_start, &tinfo[tnum]);\n" " if (s != 0)\n" " handle_error_en(s, \"pthread_create\");\n" " }\n" "\\&\n" " /* Détruire l'objet des attributs du thread dans la mesure où\n" " il n'est plus nécessaire. */\n" "\\&\n" " s = pthread_attr_destroy(&attr);\n" " if (s != 0)\n" " handle_error_en(s, \"pthread_attr_destroy\");\n" "\\&\n" " /* Maintenant joindre chaque thread et afficher la valeur qu'il renvoie. */\n" "\\&\n" " for (size_t tnum = 0; tnum E num_threads; tnum++) {\n" " s = pthread_join(tinfo[tnum].thread_id, &res);\n" " if (s != 0)\n" " handle_error_en(s, \"pthread_join\");\n" "\\&\n" " printf(\"Thread joint %d ; la valeur renvoyée est %s\\en\",\n" " tinfo[tnum].thread_num, (char *) res);\n" " free(res); /* Libérer la mémoire allouée par thread */\n" " }\n" "\\&\n" " free(tinfo);\n" " exit(EXIT_SUCCESS);\n" "}\n" #. SRC END #. type: SH #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed #, no-wrap msgid "SEE ALSO" msgstr "VOIR AUSSI" #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "" "B(2), B(3), B(3), " "B(3), B(3), B(3), " "B(3), B(3), B(3), " "B(3), B(7)" msgstr "" "B(2), B(3), B(3), " "B(3), B(3), B(3), " "B(3), B(3), B(3), " "B(3), B(7)" #. type: TH #: debian-bookworm #, no-wrap msgid "2023-02-05" msgstr "5 février 2023" #. type: TH #: debian-bookworm #, no-wrap msgid "Linux man-pages 6.03" msgstr "Pages du manuel de Linux 6.03" #. type: Plain text #: debian-bookworm msgid "POSIX.1-2001, POSIX.1-2008." msgstr "POSIX.1-2001, POSIX.1-2008." #. type: Plain text #: debian-bookworm opensuse-leap-15-6 msgid "" "Under the NPTL threading implementation, if the B soft " "resource limit I has any value other than " "\"unlimited\", then it determines the default stack size of new threads. " "Using B(3), the stack size attribute can be " "explicitly set in the I argument used to create a thread, in order to " "obtain a stack size other than the default. If the B resource " "limit is set to \"unlimited\", a per-architecture value is used for the " "stack size. Here is the value for a few architectures:" msgstr "" "Avec l'implémentation NPTL, si la limite souple B a une valeur " "autre qu'«\\ unlimited\\ » I, elle " "détermine la taille de la pile par défaut pour les nouveaux threads. Afin " "d'obtenir une taille de pile différente de la valeur par défaut, il faut " "appeler B(3) avec la valeur souhaitée sur " "l'argument I utilisé pour créer un thread. Si la limite de ressources " "B a la valeur «\\ unlimited\\ », une valeur dépendant de " "l'architecture est utilisée pour la taille de la pile. Voici cette valeur " "pour quelques architectures :" #. type: tbl table #: debian-bookworm opensuse-leap-15-6 #, no-wrap msgid "Architecture" msgstr "Architecture" #. type: tbl table #: debian-bookworm opensuse-leap-15-6 #, no-wrap msgid "Default stack size" msgstr "Taille de pile par défaut" #. type: tbl table #: debian-bookworm opensuse-leap-15-6 #, no-wrap msgid "i386" msgstr "i386" #. type: tbl table #: debian-bookworm opensuse-leap-15-6 #, no-wrap msgid "2 MB" msgstr "2 Mo" #. type: tbl table #: debian-bookworm opensuse-leap-15-6 #, no-wrap msgid "IA-64" msgstr "IA-64" #. type: tbl table #: debian-bookworm opensuse-leap-15-6 #, no-wrap msgid "32 MB" msgstr "32 Mo" #. type: tbl table #: debian-bookworm opensuse-leap-15-6 #, no-wrap msgid "PowerPC" msgstr "PowerPC" #. type: tbl table #: debian-bookworm opensuse-leap-15-6 #, no-wrap msgid "4 MB" msgstr "4 Mo" #. type: tbl table #: debian-bookworm opensuse-leap-15-6 #, no-wrap msgid "S/390" msgstr "S/390" #. type: tbl table #: debian-bookworm opensuse-leap-15-6 #, no-wrap msgid "Sparc-32" msgstr "Sparc-32" #. type: tbl table #: debian-bookworm opensuse-leap-15-6 #, no-wrap msgid "Sparc-64" msgstr "Sparc-64" #. type: tbl table #: debian-bookworm opensuse-leap-15-6 #, no-wrap msgid "x86_64" msgstr "x86_64" #. type: Plain text #: debian-bookworm opensuse-leap-15-6 #, no-wrap msgid "" "#include Ectype.hE\n" "#include Eerrno.hE\n" "#include Epthread.hE\n" "#include Estdio.hE\n" "#include Estdlib.hE\n" "#include Estring.hE\n" "#include Eunistd.hE\n" msgstr "" "#include Ectype.hE\n" "#include Eerrno.hE\n" "#include Epthread.hE\n" "#include Estdio.hE\n" "#include Estdlib.hE\n" "#include Estring.hE\n" "#include Eunistd.hE\n" #. type: Plain text #: debian-bookworm opensuse-leap-15-6 #, no-wrap msgid "" "#define handle_error_en(en, msg) \\e\n" " do { errno = en; perror(msg); exit(EXIT_FAILURE); } while (0)\n" msgstr "" "#define handle_error_en(en, msg) \\e\n" " do { errno = en; perror(msg); exit(EXIT_FAILURE); } while (0)\n" #. type: Plain text #: debian-bookworm opensuse-leap-15-6 #, no-wrap msgid "" "#define handle_error(msg) \\e\n" " do { perror(msg); exit(EXIT_FAILURE); } while (0)\n" msgstr "" "#define handle_error(msg) \\e\n" " do { perror(msg); exit(EXIT_FAILURE); } while (0)\n" #. type: Plain text #: debian-bookworm opensuse-leap-15-6 #, no-wrap msgid "" "struct thread_info { /* Used as argument to thread_start() */\n" " pthread_t thread_id; /* ID returned by pthread_create() */\n" " int thread_num; /* Application-defined thread # */\n" " char *argv_string; /* From command-line argument */\n" "};\n" msgstr "" "struct thread_info { /* Utilisé comme argument pour thread_start() */\n" " pthread_t thread_id; /* Identifiant renvoyé par pthread_create() */\n" " int thread_num; /* N° de thread défini par l'application */\n" " char *argv_string; /* À partir de l'argument en ligne de commande */\n" "};\n" #. type: Plain text #: debian-bookworm opensuse-leap-15-6 #, no-wrap msgid "" "/* Thread start function: display address near top of our stack,\n" " and return upper-cased copy of argv_string. */\n" msgstr "" "/* Fonction de démarrage du thread : affiche l'adresse vers le haut de la pile,\n" " et renvoie une copie en majuscule de argv_string. */\n" #. type: Plain text #: debian-bookworm opensuse-leap-15-6 #, no-wrap msgid "" "static void *\n" "thread_start(void *arg)\n" "{\n" " struct thread_info *tinfo = arg;\n" " char *uargv;\n" msgstr "" "static void *\n" "thread_start(void *arg)\n" "{\n" " struct thread_info *tinfo = arg;\n" " char *uargv;\n" #. type: Plain text #: debian-bookworm opensuse-leap-15-6 #, no-wrap msgid "" " printf(\"Thread %d: top of stack near %p; argv_string=%s\\en\",\n" " tinfo-Ethread_num, (void *) &tinfo, tinfo-Eargv_string);\n" msgstr "" " printf(\"Thread %d : sommet de la pile près de %p; argv_string=%s\\en\",\n" " tinfo-Ethread_num, (void *) &tinfo, tinfo-Eargv_string);\n" #. type: Plain text #: debian-bookworm opensuse-leap-15-6 #, no-wrap msgid "" " uargv = strdup(tinfo-Eargv_string);\n" " if (uargv == NULL)\n" " handle_error(\"strdup\");\n" msgstr "" " uargv = strdup(tinfo-Eargv_string);\n" " if (uargv == NULL)\n" " handle_error(\"strdup\");\n" #. type: Plain text #: debian-bookworm opensuse-leap-15-6 #, no-wrap msgid "" " for (char *p = uargv; *p != \\[aq]\\e0\\[aq]; p++)\n" " *p = toupper(*p);\n" msgstr "" " for (char *p = uargv; *p != \\[aq]\\e0\\[aq]; p++)\n" " *p = toupper(*p);\n" #. type: Plain text #: debian-bookworm opensuse-leap-15-6 #, no-wrap msgid "" " return uargv;\n" "}\n" msgstr "" " return uargv;\n" "}\n" #. type: Plain text #: debian-bookworm opensuse-leap-15-6 #, no-wrap msgid "" "int\n" "main(int argc, char *argv[])\n" "{\n" " int s, opt;\n" " void *res;\n" " size_t num_threads;\n" " ssize_t stack_size;\n" " pthread_attr_t attr;\n" " struct thread_info *tinfo;\n" msgstr "" "int\n" "main(int argc, char *argv[])\n" "{\n" " int s, opt;\n" " void *res;\n" " size_t num_threads;\n" " ssize_t stack_size;\n" " pthread_attr_t attr;\n" " struct thread_info *tinfo;\n" #. type: Plain text #: debian-bookworm opensuse-leap-15-6 #, no-wrap msgid " /* The \"-s\" option specifies a stack size for our threads. */\n" msgstr " /* L'option \"-s\" spécifie une taille de pile pour les threads. */\n" #. type: Plain text #: debian-bookworm opensuse-leap-15-6 #, no-wrap msgid "" " stack_size = -1;\n" " while ((opt = getopt(argc, argv, \"s:\")) != -1) {\n" " switch (opt) {\n" " case \\[aq]s\\[aq]:\n" " stack_size = strtoul(optarg, NULL, 0);\n" " break;\n" msgstr "" " stack_size = -1;\n" " while ((opt = getopt(argc, argv, \"s:\")) != -1) {\n" " switch (opt) {\n" " case \\[aq]s\\[aq]:\n" " stack_size = strtoul(optarg, NULL, 0);\n" " break;\n" #. type: Plain text #: debian-bookworm opensuse-leap-15-6 #, no-wrap msgid "" " default:\n" " fprintf(stderr, \"Usage: %s [-s stack-size] arg...\\en\",\n" " argv[0]);\n" " exit(EXIT_FAILURE);\n" " }\n" " }\n" msgstr "" " default:\n" " fprintf(stderr, \"Usage: %s [-s stack-size] arg...\\en\",\n" " argv[0]);\n" " exit(EXIT_FAILURE);\n" " }\n" " }\n" #. type: Plain text #: debian-bookworm opensuse-leap-15-6 #, no-wrap msgid " num_threads = argc - optind;\n" msgstr " num_threads = argc - optind;\n" #. type: Plain text #: debian-bookworm opensuse-leap-15-6 #, no-wrap msgid " /* Initialize thread creation attributes. */\n" msgstr " /* Initialiser les attributs de création de thread. */\n" #. type: Plain text #: debian-bookworm opensuse-leap-15-6 #, no-wrap msgid "" " s = pthread_attr_init(&attr);\n" " if (s != 0)\n" " handle_error_en(s, \"pthread_attr_init\");\n" msgstr "" " s = pthread_attr_init(&attr);\n" " if (s != 0)\n" " handle_error_en(s, \"pthread_attr_init\");\n" #. type: Plain text #: debian-bookworm opensuse-leap-15-6 #, no-wrap msgid "" " if (stack_size E 0) {\n" " s = pthread_attr_setstacksize(&attr, stack_size);\n" " if (s != 0)\n" " handle_error_en(s, \"pthread_attr_setstacksize\");\n" " }\n" msgstr "" " if (stack_size E 0) {\n" " s = pthread_attr_setstacksize(&attr, stack_size);\n" " if (s != 0)\n" " handle_error_en(s, \"pthread_attr_setstacksize\");\n" " }\n" #. type: Plain text #: debian-bookworm opensuse-leap-15-6 #, no-wrap msgid " /* Allocate memory for pthread_create() arguments. */\n" msgstr " /* Allouer la mémoire pour les arguments de pthread_create(). */\n" #. type: Plain text #: debian-bookworm opensuse-leap-15-6 #, no-wrap msgid "" " tinfo = calloc(num_threads, sizeof(*tinfo));\n" " if (tinfo == NULL)\n" " handle_error(\"calloc\");\n" msgstr "" " tinfo = calloc(num_threads, sizeof(*tinfo));\n" " if (tinfo == NULL)\n" " handle_error(\"calloc\");\n" #. type: Plain text #: debian-bookworm opensuse-leap-15-6 #, no-wrap msgid " /* Create one thread for each command-line argument. */\n" msgstr " /* Créer un thread pour chaque argument en ligne de commande. */\n" #. type: Plain text #: debian-bookworm opensuse-leap-15-6 #, no-wrap msgid "" " for (size_t tnum = 0; tnum E num_threads; tnum++) {\n" " tinfo[tnum].thread_num = tnum + 1;\n" " tinfo[tnum].argv_string = argv[optind + tnum];\n" msgstr "" " for (size_t tnum = 0; tnum E num_threads; tnum++) {\n" " tinfo[tnum].thread_num = tnum + 1;\n" " tinfo[tnum].argv_string = argv[optind + tnum];\n" #. type: Plain text #: debian-bookworm opensuse-leap-15-6 #, no-wrap msgid "" " /* The pthread_create() call stores the thread ID into\n" " corresponding element of tinfo[]. */\n" msgstr "" " /* L'appel pthread_create() stocke l'identifiant du thread dans\n" " l'élément correspondant de tinfo[]. */\n" #. type: Plain text #: debian-bookworm opensuse-leap-15-6 #, no-wrap msgid "" " s = pthread_create(&tinfo[tnum].thread_id, &attr,\n" " &thread_start, &tinfo[tnum]);\n" " if (s != 0)\n" " handle_error_en(s, \"pthread_create\");\n" " }\n" msgstr "" " s = pthread_create(&tinfo[tnum].thread_id, &attr,\n" " &thread_start, &tinfo[tnum]);\n" " if (s != 0)\n" " handle_error_en(s, \"pthread_create\");\n" " }\n" #. type: Plain text #: debian-bookworm opensuse-leap-15-6 #, no-wrap msgid "" " /* Destroy the thread attributes object, since it is no\n" " longer needed. */\n" msgstr "" " /* Détruire l'objet des attributs du thread dans la mesure où\n" " il n'est plus nécessaire. */\n" #. type: Plain text #: debian-bookworm opensuse-leap-15-6 #, no-wrap msgid "" " s = pthread_attr_destroy(&attr);\n" " if (s != 0)\n" " handle_error_en(s, \"pthread_attr_destroy\");\n" msgstr "" " s = pthread_attr_destroy(&attr);\n" " if (s != 0)\n" " handle_error_en(s, \"pthread_attr_destroy\");\n" #. type: Plain text #: debian-bookworm opensuse-leap-15-6 #, no-wrap msgid " /* Now join with each thread, and display its returned value. */\n" msgstr " /* Maintenant joindre chaque thread et afficher la valeur qu'il renvoie. */\n" #. type: Plain text #: debian-bookworm opensuse-leap-15-6 #, no-wrap msgid "" " for (size_t tnum = 0; tnum E num_threads; tnum++) {\n" " s = pthread_join(tinfo[tnum].thread_id, &res);\n" " if (s != 0)\n" " handle_error_en(s, \"pthread_join\");\n" msgstr "" " for (size_t tnum = 0; tnum E num_threads; tnum++) {\n" " s = pthread_join(tinfo[tnum].thread_id, &res);\n" " if (s != 0)\n" " handle_error_en(s, \"pthread_join\");\n" #. type: Plain text #: debian-bookworm opensuse-leap-15-6 #, no-wrap msgid "" " printf(\"Joined with thread %d; returned value was %s\\en\",\n" " tinfo[tnum].thread_num, (char *) res);\n" " free(res); /* Free memory allocated by thread */\n" " }\n" msgstr "" " printf(\"Thread joint %d ; la valeur renvoyée est %s\\en\",\n" " tinfo[tnum].thread_num, (char *) res);\n" " free(res); /* Libérer la mémoire allouée par thread */\n" " }\n" #. type: Plain text #: debian-bookworm opensuse-leap-15-6 #, no-wrap msgid "" " free(tinfo);\n" " exit(EXIT_SUCCESS);\n" "}\n" msgstr "" " free(tinfo);\n" " exit(EXIT_SUCCESS);\n" "}\n" #. type: TH #: fedora-40 fedora-rawhide mageia-cauldron #, no-wrap msgid "2024-02-12" msgstr "12 février 2024" #. type: TH #: fedora-40 mageia-cauldron #, no-wrap msgid "Linux man-pages 6.06" msgstr "Pages du manuel de Linux 6.06" #. type: Plain text #: fedora-40 fedora-rawhide mageia-cauldron #, no-wrap msgid "" "#include Ectype.hE\n" "#include Eerrno.hE\n" "#include Epthread.hE\n" "#include Estdio.hE\n" "#include Estdlib.hE\n" "#include Estring.hE\n" "#include Eunistd.hE\n" "\\&\n" "#define handle_error_en(en, msg) \\e\n" " do { errno = en; perror(msg); exit(EXIT_FAILURE); } while (0)\n" "\\&\n" "#define handle_error(msg) \\e\n" " do { perror(msg); exit(EXIT_FAILURE); } while (0)\n" "\\&\n" "struct thread_info { /* Used as argument to thread_start() */\n" " pthread_t thread_id; /* ID returned by pthread_create() */\n" " int thread_num; /* Application-defined thread # */\n" " char *argv_string; /* From command-line argument */\n" "};\n" "\\&\n" "/* Thread start function: display address near top of our stack,\n" " and return upper-cased copy of argv_string. */\n" "\\&\n" "static void *\n" "thread_start(void *arg)\n" "{\n" " struct thread_info *tinfo = arg;\n" " char *uargv;\n" "\\&\n" " printf(\"Thread %d: top of stack near %p; argv_string=%s\\en\",\n" " tinfo-Ethread_num, (void *) &tinfo, tinfo-Eargv_string);\n" "\\&\n" " uargv = strdup(tinfo-Eargv_string);\n" " if (uargv == NULL)\n" " handle_error(\"strdup\");\n" "\\&\n" " for (char *p = uargv; *p != \\[aq]\\e0\\[aq]; p++)\n" " *p = toupper(*p);\n" "\\&\n" " return uargv;\n" "}\n" "\\&\n" "int\n" "main(int argc, char *argv[])\n" "{\n" " int s, opt;\n" " void *res;\n" " size_t num_threads;\n" " ssize_t stack_size;\n" " pthread_attr_t attr;\n" " struct thread_info *tinfo;\n" "\\&\n" " /* The \"-s\" option specifies a stack size for our threads. */\n" "\\&\n" " stack_size = -1;\n" " while ((opt = getopt(argc, argv, \"s:\")) != -1) {\n" " switch (opt) {\n" " case \\[aq]s\\[aq]:\n" " stack_size = strtoul(optarg, NULL, 0);\n" " break;\n" "\\&\n" " default:\n" " fprintf(stderr, \"Usage: %s [-s stack-size] arg...\\en\",\n" " argv[0]);\n" " exit(EXIT_FAILURE);\n" " }\n" " }\n" "\\&\n" " num_threads = argc - optind;\n" "\\&\n" " /* Initialize thread creation attributes. */\n" "\\&\n" " s = pthread_attr_init(&attr);\n" " if (s != 0)\n" " handle_error_en(s, \"pthread_attr_init\");\n" "\\&\n" " if (stack_size E 0) {\n" " s = pthread_attr_setstacksize(&attr, stack_size);\n" " if (s != 0)\n" " handle_error_en(s, \"pthread_attr_setstacksize\");\n" " }\n" "\\&\n" " /* Allocate memory for pthread_create() arguments. */\n" "\\&\n" " tinfo = calloc(num_threads, sizeof(*tinfo));\n" " if (tinfo == NULL)\n" " handle_error(\"calloc\");\n" "\\&\n" " /* Create one thread for each command-line argument. */\n" "\\&\n" " for (size_t tnum = 0; tnum E num_threads; tnum++) {\n" " tinfo[tnum].thread_num = tnum + 1;\n" " tinfo[tnum].argv_string = argv[optind + tnum];\n" "\\&\n" " /* The pthread_create() call stores the thread ID into\n" " corresponding element of tinfo[]. */\n" "\\&\n" " s = pthread_create(&tinfo[tnum].thread_id, &attr,\n" " &thread_start, &tinfo[tnum]);\n" " if (s != 0)\n" " handle_error_en(s, \"pthread_create\");\n" " }\n" "\\&\n" " /* Destroy the thread attributes object, since it is no\n" " longer needed. */\n" "\\&\n" " s = pthread_attr_destroy(&attr);\n" " if (s != 0)\n" " handle_error_en(s, \"pthread_attr_destroy\");\n" "\\&\n" " /* Now join with each thread, and display its returned value. */\n" "\\&\n" " for (size_t tnum = 0; tnum E num_threads; tnum++) {\n" " s = pthread_join(tinfo[tnum].thread_id, &res);\n" " if (s != 0)\n" " handle_error_en(s, \"pthread_join\");\n" "\\&\n" " printf(\"Joined with thread %d; returned value was %s\\en\",\n" " tinfo[tnum].thread_num, (char *) res);\n" " free(res); /* Free memory allocated by thread */\n" " }\n" "\\&\n" " free(tinfo);\n" " exit(EXIT_SUCCESS);\n" "}\n" msgstr "" "#include Ectype.hE\n" "#include Eerrno.hE\n" "#include Epthread.hE\n" "#include Estdio.hE\n" "#include Estdlib.hE\n" "#include Estring.hE\n" "#include Eunistd.hE\n" "\\&\n" "#define handle_error_en(en, msg) \\e\n" " do { errno = en; perror(msg); exit(EXIT_FAILURE); } while (0)\n" "\\&\n" "#define handle_error(msg) \\e\n" " do { perror(msg); exit(EXIT_FAILURE); } while (0)\n" "\\&\n" "struct thread_info { /* Utilisé comme argument pour thread_start() */\n" " pthread_t thread_id; /* Identifiant renvoyé par pthread_create() */\n" " int thread_num; /* N° de thread défini par l'application */\n" " char *argv_string; /* À partir de l'argument en ligne de commande */\n" "};\n" "\\&\n" "/* Fonction de démarrage du thread : affiche l'adresse vers le haut de la pile,\n" " et renvoie une copie en majuscule de argv_string. */\n" "\\&\n" "static void *\n" "thread_start(void *arg)\n" "{\n" " struct thread_info *tinfo = arg;\n" " char *uargv;\n" "\\&\n" " printf(\"Thread %d : sommet de la pile près de %p; argv_string=%s\\en\",\n" " tinfo-Ethread_num, (void *) &tinfo, tinfo-Eargv_string);\n" "\\&\n" " uargv = strdup(tinfo-Eargv_string);\n" " if (uargv == NULL)\n" " handle_error(\"strdup\");\n" "\\&\n" " for (char *p = uargv; *p != \\[aq]\\e0\\[aq]; p++)\n" " *p = toupper(*p);\n" "\\&\n" " return uargv;\n" "}\n" "\\&\n" "int\n" "main(int argc, char *argv[])\n" "{\n" " int s, opt;\n" " void *res;\n" " size_t num_threads;\n" " ssize_t stack_size;\n" " pthread_attr_t attr;\n" " struct thread_info *tinfo;\n" "\\&\n" " /* L'option \"-s\" spécifie une taille de pile pour les threads. */\n" "\\&\n" " stack_size = -1;\n" " while ((opt = getopt(argc, argv, \"s:\")) != -1) {\n" " switch (opt) {\n" " case \\[aq]s\\[aq]:\n" " stack_size = strtoul(optarg, NULL, 0);\n" " break;\n" "\\&\n" " default:\n" " fprintf(stderr, \"Usage : %s [-s stack-size] arg...\\en\",\n" " argv[0]);\n" " exit(EXIT_FAILURE);\n" " }\n" " }\n" "\\&\n" " num_threads = argc - optind;\n" "\\&\n" " /* Initialiser les attributs de création de thread. */\n" "\\&\n" " s = pthread_attr_init(&attr);\n" " if (s != 0)\n" " handle_error_en(s, \"pthread_attr_init\");\n" "\\&\n" " if (stack_size E 0) {\n" " s = pthread_attr_setstacksize(&attr, stack_size);\n" " if (s != 0)\n" " handle_error_en(s, \"pthread_attr_setstacksize\");\n" " }\n" "\\&\n" " /* Allouer la mémoire pour les arguments de pthread_create(). */\n" "\\&\n" " tinfo = calloc(num_threads, sizeof(*tinfo));\n" " if (tinfo == NULL)\n" " handle_error(\"calloc\");\n" "\\&\n" " /* Créer un thread pour chaque argument en ligne de commande. */\n" "\\&\n" " for (size_t tnum = 0; tnum E num_threads; tnum++) {\n" " tinfo[tnum].thread_num = tnum + 1;\n" " tinfo[tnum].argv_string = argv[optind + tnum];\n" "\\&\n" " /* L'appel pthread_create() stocke l'identifiant du thread dans\n" " l'élément correspondant de tinfo[]. */\n" "\\&\n" " s = pthread_create(&tinfo[tnum].thread_id, &attr,\n" " &thread_start, &tinfo[tnum]);\n" " if (s != 0)\n" " handle_error_en(s, \"pthread_create\");\n" " }\n" "\\&\n" " /* Détruire l'objet des attributs du thread dans la mesure où\n" " il n'est plus nécessaire. */\n" "\\&\n" " s = pthread_attr_destroy(&attr);\n" " if (s != 0)\n" " handle_error_en(s, \"pthread_attr_destroy\");\n" "\\&\n" " /* Maintenant joindre chaque thread et afficher la valeur qu'il renvoie. */\n" "\\&\n" " for (size_t tnum = 0; tnum E num_threads; tnum++) {\n" " s = pthread_join(tinfo[tnum].thread_id, &res);\n" " if (s != 0)\n" " handle_error_en(s, \"pthread_join\");\n" "\\&\n" " printf(\"Thread joint %d ; la valeur renvoyée est %s\\en\",\n" " tinfo[tnum].thread_num, (char *) res);\n" " free(res); /* Libérer la mémoire allouée par thread */\n" " }\n" "\\&\n" " free(tinfo);\n" " exit(EXIT_SUCCESS);\n" "}\n" #. type: TH #: fedora-rawhide #, no-wrap msgid "Linux man-pages 6.7" msgstr "Pages du manuel de Linux 6.7" #. type: TH #: opensuse-leap-15-6 #, no-wrap msgid "2023-03-30" msgstr "30 mars 2023" #. type: TH #: opensuse-leap-15-6 #, no-wrap msgid "Linux man-pages 6.04" msgstr "Pages du manuel de Linux 6.04" #. type: TH #: opensuse-tumbleweed #, no-wrap msgid "Linux man-pages (unreleased)" msgstr "Pages du manuel de Linux (non publiées)"