Provided by: manpages-fr-dev_4.13-4_all bug

NOM

       pthread_join - Joindre un thread terminé

SYNOPSIS

       #include <pthread.h>

       int pthread_join(pthread_t thread, void **retval);

       Compiler et éditer les liens avec -pthreads.

DESCRIPTION

       La  fonction pthread_join()  attend que le thread spécifié par thread se termine. Si ce thread s'est déjà
       terminé, pthread_join() revient tout de suite. Le thread spécifié par thread doit être joignable.

       If retval is not NULL, then pthread_join()  copies the exit status of the target thread (i.e., the  value
       that  the  target  thread  supplied  to  pthread_exit(3))  into the location pointed to by retval. If the
       target thread was canceled, then PTHREAD_CANCELED is placed in the location pointed to by retval.

       Si plusieurs threads essaient simultanément de joindre le même thread, le résultat est  indéfini.  Si  le
       thread  appelant  pthread_join()  est annulé, le thread cible reste joignable (c'est-à-dire qu'il ne sera
       pas détaché).

VALEUR RENVOYÉE

       En cas de réussite, pthread_join() renvoie 0 ; en cas d'erreur, elle renvoie un numéro d'erreur.

ERREURS

       EDEADLK
              Un verrou perpétuel (deadlock) a été détecté, par exemple deux  threads  essaient  de  se  joindre
              mutuellement ; ou bien thread est aussi le thread appelant.

       EINVAL thread n'est pas un thread joignable.

       EINVAL Un autre thread attend déjà de joindre ce thread.

       ESRCH  Aucun fil d’exécution avec pour identifiant thread n'a pu être trouvé.

ATTRIBUTS

       Pour une explication des termes utilisés dans cette section, consulter attributes(7).
       ┌────────────────┬──────────────────────┬─────────┐
       │ InterfaceAttributValeur  │
       ├────────────────┼──────────────────────┼─────────┤
       │ pthread_join() │ Sécurité des threads │ MT-Safe │
       └────────────────┴──────────────────────┴─────────┘

CONFORMITÉ

       POSIX.1-2001, POSIX.1-2008.

NOTES

       After  a  successful  call  to  pthread_join(),  the  caller  is  guaranteed  that  the target thread has
       terminated. The caller may then choose to do any clean-up that  is  required  after  termination  of  the
       thread (e.g., freeing memory or other resources that were allocated to the target thread).

       Joindre un thread qui avait préalablement été joint résulte en un comportement indéfini.

       Un  échec  à joindre un thread qui est joignable (c'est-à-dire non détaché) produit un « thread zombie ».
       Il faut l'éviter, car chaque thread zombie consomme des ressources du système,  et  si  trop  de  threads
       zombies s'accumulent, il ne sera plus possible de créer de nouveaux threads (ou de nouveaux processus).

       Il  n'existe  pas  d'analogue pthreads à waitpid(-1, &status, 0) pour joindre tout thread non terminé. Si
       vous pensez avoir besoin de cette fonctionnalité, vous devez probablement repenser la conception de votre
       application.

       Tous les threads dans un processus sont au même niveau : tout thread peut joindre tout  autre  thread  du
       processus.

EXEMPLES

       Consultez pthread_create(3).

VOIR AUSSI

       pthread_cancel(3),    pthread_create(3),   pthread_detach(3),   pthread_exit(3),   pthread_tryjoin_np(3),
       pthreads(7)

COLOPHON

       Cette page fait partie de la publication 5.10 du projet man-pages Linux. Une description du projet et des
       instructions pour signaler des anomalies et la dernière version de cette page  peuvent  être  trouvées  à
       l'adresse https://www.kernel.org/doc/man-pages/.

TRADUCTION

       La   traduction   française   de   cette   page   de   manuel   a   été   créée   par  Christophe  Blaess
       <https://www.blaess.fr/christophe/>,   Stéphan   Rafin   <stephan.rafin@laposte.net>,   Thierry   Vignaud
       <tvignaud@mandriva.com>,  François  Micaux,  Alain Portal <aportal@univ-montp2.fr>, Jean-Philippe Guérard
       <fevrier@tigreraye.org>,   Jean-Luc   Coulon   (f5ibh)   <jean-luc.coulon@wanadoo.fr>,   Julien   Cristau
       <jcristau@debian.org>,      Thomas      Huriaux      <thomas.huriaux@gmail.com>,     Nicolas     François
       <nicolas.francois@centraliens.net>,    Florentin    Duneau    <fduneau@gmail.com>,     Simon     Paillard
       <simon.paillard@resel.enst-bretagne.fr>,     Denis    Barbier    <barbier@debian.org>,    David    Prévot
       <david@tilapin.org> et Frédéric Hantrais <fhantrais@gmail.com>

       Cette traduction est une documentation libre ; veuillez vous  reporter  à  la  GNU General Public License
       version 3 concernant les conditions de copie et de distribution. Il n'y a aucune RESPONSABILITÉ LÉGALE.

       Si  vous  découvrez  un  bogue  dans la traduction de cette page de manuel, veuillez envoyer un message à
       debian-l10n-french@lists.debian.org.

Linux                                              9 juin 2020                                   PTHREAD_JOIN(3)