.\" Copyright (c) 2008 Linux Foundation, written by Michael Kerrisk .\" .\" .\" Permission is granted to make and distribute verbatim copies of this .\" manual provided the copyright notice and this permission notice are .\" preserved on all copies. .\" .\" Permission is granted to copy and distribute modified versions of this .\" manual under the conditions for verbatim copying, provided that the .\" entire resulting derived work is distributed under the terms of a .\" permission notice identical to this one. .\" .\" Since the Linux kernel and libraries are constantly changing, this .\" manual page may be incorrect or out-of-date. The author(s) assume no .\" responsibility for errors or omissions, or for damages resulting from .\" the use of the information contained herein. The author(s) may not .\" have taken the same level of care in the production of this manual, .\" which is licensed free of charge, as they might when working .\" professionally. .\" .\" Formatted or processed versions of this manual, if unaccompanied by .\" the source, must acknowledge the copyright and authors of this work. .\" .\"******************************************************************* .\" .\" This file was generated with po4a. Translate the source file. .\" .\"******************************************************************* .TH PTHREAD_DETACH 3 "27 novembre 2008" Linux "Manuel du programmeur Linux" .SH NOM pthread_detach \- Détacher un thread .SH SYNOPSIS .nf \fB#include \fP \fBint pthread_detach(pthread_t \fP\fIthread\fP\fB);\fP .fi .sp Compilez et effectuez l'édition des liens avec l'option \fI\-pthread\fP. .SH DESCRIPTION La fonction \fBpthread_detach\fP() marque l'identifiant de thread identifié par \fIthread\fP comme détaché. Quand un thread détaché se termine, ses ressources sont automatiquement rendues au système sans avoir besoin d'un autre thread pour joindre le thread terminé. Essayer de détacher un thread qui est déjà détaché résulte en un comportement indéfini. .SH "VALEUR RENVOYÉE" En cas de réussite, \fBpthread_detach\fP() renvoie 0\ ; en cas d'erreur, elle renvoie un numéro d'erreur. .SH ERREURS .TP \fBEINVAL\fP \fIthread\fP n'est pas un thread joignable. .TP \fBESRCH\fP Aucun thread avec pour identifiant \fIthread\fP n'a pu être trouvé. .SH CONFORMITÉ POSIX.1\-2001. .SH NOTES Une fois qu'un thread est détaché, il ne peut plus être joint avec \fBpthread_join\fP(3) ou être fait de nouveau joignable. Un nouveau thread peut être créé dans un état détaché en utilisant \fBpthread_attr_setdetachstate\fP(3) pour positionner l'attribut détaché de l'argument \fIattr\fP de \fBpthread_create\fP(3). L'attribut d'état de détachement détermine principalement le comportement du système quand le thread se termine. Il n'empêche pas le thread de terminer si le processus se termine avec \fBexit\fP(3) (ou, de manière équivalente, si le thread principal sort de sa routine d'appel). Soit \fBpthread_join\fP(3), soit \fBpthread_detach\fP() devrait être appelé pour chaque thread créé par une application, afin que les ressources système du thread puissent être libérées. Notez cependant que les ressources de tous les threads sont libérées quand le processus se termine. .SH EXEMPLE L'expression suivante détache le thread appelant\ : pthread_detach(pthread_self()); .SH "VOIR AUSSI" \fBpthread_attr_setdetachstate\fP(3), \fBpthread_cancel\fP(3), \fBpthread_create\fP(3), \fBpthread_exit\fP(3), \fBpthread_join\fP(3), \fBpthreads\fP(7) .SH COLOPHON Cette page fait partie de la publication 3.44 du projet \fIman\-pages\fP Linux. Une description du projet et des instructions pour signaler des anomalies peuvent être trouvées à l'adresse . .SH TRADUCTION Depuis 2010, cette traduction est maintenue à l'aide de l'outil po4a par l'équipe de traduction francophone au sein du projet perkamon . .PP Denis Barbier (2010). .PP Veuillez signaler toute erreur de traduction en écrivant à ou par un rapport de bogue sur le paquet \fBmanpages\-fr\fR. .PP Vous pouvez toujours avoir accès à la version anglaise de ce document en utilisant la commande «\ \fBman\ \-L C\fR \fI
\fR\ \fI\fR\ ».