| 1 |
# French translation of manpages |
| 2 |
# This file is distributed under the same license as the manpages-l10n package. |
| 3 |
# Copyright © of this file: |
| 4 |
# Christophe Blaess <https://www.blaess.fr/christophe/>, 1996-2003. |
| 5 |
# Stéphan Rafin <[email protected]>, 2002. |
| 6 |
# Thierry Vignaud <[email protected]>, 1999, 2002. |
| 7 |
# François Micaux, 2002. |
| 8 |
# Alain Portal <[email protected]>, 2003-2008. |
| 9 |
# Jean-Philippe Guérard <[email protected]>, 2005-2006. |
| 10 |
# Jean-Luc Coulon (f5ibh) <[email protected]>, 2006-2007. |
| 11 |
# Julien Cristau <[email protected]>, 2006-2007. |
| 12 |
# Thomas Huriaux <[email protected]>, 2006-2008. |
| 13 |
# Nicolas François <[email protected]>, 2006-2008. |
| 14 |
# Florentin Duneau <[email protected]>, 2006-2010. |
| 15 |
# Simon Paillard <[email protected]>, 2006. |
| 16 |
# Denis Barbier <[email protected]>, 2006, 2010. |
| 17 |
# David Prévot <[email protected]>, 2010, 2012. |
| 18 |
# Frédéric Hantrais <[email protected]>, 2013, 2014. |
| 19 |
# Jean-Pierre Giraud <[email protected]>, 2023-2024. |
| 20 |
msgid "" |
| 21 |
msgstr "" |
| 22 |
"Project-Id-Version: manpages-l10n 4.22.0\n" |
| 23 |
"POT-Creation-Date: 2026-06-05 06:38+0200\n" |
| 24 |
"PO-Revision-Date: 2024-06-03 11:48+0200\n" |
| 25 |
"Last-Translator: Jean-Pierre Giraud <[email protected]>\n" |
| 26 |
"Language-Team: French <[email protected]>\n" |
| 27 |
"Language: fr\n" |
| 28 |
"MIME-Version: 1.0\n" |
| 29 |
"Content-Type: text/plain; charset=UTF-8\n" |
| 30 |
"Content-Transfer-Encoding: 8bit\n" |
| 31 |
"Plural-Forms: nplurals=2; plural=n > 1;\n" |
| 32 |
"X-Generator: Lokalize 22.12.3\n" |
| 33 |
|
| 34 |
#. type: TH |
| 35 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 36 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 37 |
#, no-wrap |
| 38 |
msgid "pthread_create" |
| 39 |
msgstr "pthread_create" |
| 40 |
|
| 41 |
#. type: TH |
| 42 |
#: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1 |
| 43 |
#: opensuse-tumbleweed |
| 44 |
#, no-wrap |
| 45 |
msgid "2026-02-10" |
| 46 |
msgstr "10 février 2026" |
| 47 |
|
| 48 |
#. type: TH |
| 49 |
#: archlinux debian-unstable |
| 50 |
#, no-wrap |
| 51 |
msgid "Linux man-pages 6.18" |
| 52 |
msgstr "Pages du manuel de Linux 6.18" |
| 53 |
|
| 54 |
#. type: SH |
| 55 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 56 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 57 |
#, no-wrap |
| 58 |
msgid "NAME" |
| 59 |
msgstr "NOM" |
| 60 |
|
| 61 |
#. type: Plain text |
| 62 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 63 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 64 |
msgid "pthread_create - create a new thread" |
| 65 |
msgstr "pthread_create – Créer un nouveau thread" |
| 66 |
|
| 67 |
#. type: SH |
| 68 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 69 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 70 |
#, no-wrap |
| 71 |
msgid "LIBRARY" |
| 72 |
msgstr "BIBLIOTHÈQUE" |
| 73 |
|
| 74 |
#. type: Plain text |
| 75 |
#: archlinux debian-unstable fedora-44 fedora-rawhide mageia-cauldron |
| 76 |
#: opensuse-leap-16-1 opensuse-tumbleweed |
| 77 |
msgid "POSIX threads library (I<libpthread>,\\ I<-lpthread>)" |
| 78 |
msgstr "Bibliothèque de threads POSIX (I<libpthread>,\\ I<-lpthread>)" |
| 79 |
|
| 80 |
#. type: SH |
| 81 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 82 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 83 |
#, no-wrap |
| 84 |
msgid "SYNOPSIS" |
| 85 |
msgstr "SYNOPSIS" |
| 86 |
|
| 87 |
#. type: Plain text |
| 88 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 89 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 90 |
#, no-wrap |
| 91 |
msgid "B<#include E<lt>pthread.hE<gt>>\n" |
| 92 |
msgstr "B<#include E<lt>pthread.hE<gt>>\n" |
| 93 |
|
| 94 |
#. type: Plain text |
| 95 |
#: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1 |
| 96 |
#: opensuse-tumbleweed |
| 97 |
#, fuzzy, no-wrap |
| 98 |
#| msgid "" |
| 99 |
#| "B<int pthread_create(pthread_t *restrict >I<thread>B<,>\n" |
| 100 |
#| "B< const pthread_attr_t *restrict >I<attr>B<,>\n" |
| 101 |
#| "B< void *(*>I<start_routine>B<)(void *),>\n" |
| 102 |
#| "B< void *restrict >I<arg>B<);>\n" |
| 103 |
msgid "" |
| 104 |
"B<int pthread_create(pthread_t *restrict >I<thread>B<,>\n" |
| 105 |
"B< const pthread_attr_t *_Nullable restrict >I<attr>B<,>\n" |
| 106 |
"B< typeof(void *(void *_Nullable)) *>I<start_routine>B<,>\n" |
| 107 |
"B< void *_Nullable restrict >I<arg>B<);>\n" |
| 108 |
msgstr "" |
| 109 |
"B<int pthread_create(pthread_t *restrict >I<thread>B<,>\n" |
| 110 |
"B< const pthread_attr_t *restrict >I<attr>B<,>\n" |
| 111 |
"B< void *(*>I<start_routine>B<)(void *),>\n" |
| 112 |
"B< void *restrict >I<arg>B<);>\n" |
| 113 |
|
| 114 |
#. type: SH |
| 115 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 116 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 117 |
#, no-wrap |
| 118 |
msgid "DESCRIPTION" |
| 119 |
msgstr "DESCRIPTION" |
| 120 |
|
| 121 |
#. type: Plain text |
| 122 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 123 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 124 |
msgid "" |
| 125 |
"The B<pthread_create>() function starts a new thread in the calling " |
| 126 |
"process. The new thread starts execution by invoking I<start_routine>(); " |
| 127 |
"I<arg> is passed as the sole argument of I<start_routine>()." |
| 128 |
msgstr "" |
| 129 |
"La fonction B<pthread_create>() démarre un nouveau thread (processus léger) " |
| 130 |
"dans le processus appelant. Le nouveau thread commence par appeler " |
| 131 |
"I<start_routine>()\\ ; I<arg> est passé comme unique argument de " |
| 132 |
"I<start_routine>()." |
| 133 |
|
| 134 |
#. type: Plain text |
| 135 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 136 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 137 |
msgid "The new thread terminates in one of the following ways:" |
| 138 |
msgstr "Le nouveau thread se termine d'une des manières suivantes\\ :" |
| 139 |
|
| 140 |
#. type: IP |
| 141 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 142 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 143 |
#, no-wrap |
| 144 |
msgid "\\[bu]" |
| 145 |
msgstr "-" |
| 146 |
|
| 147 |
#. type: Plain text |
| 148 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 149 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 150 |
msgid "" |
| 151 |
"It calls B<pthread_exit>(3), specifying an exit status value that is " |
| 152 |
"available to another thread in the same process that calls " |
| 153 |
"B<pthread_join>(3)." |
| 154 |
msgstr "" |
| 155 |
"Il appelle B<pthread_exit>(3), en indiquant une valeur de sortie qui sera " |
| 156 |
"disponible pour un autre thread du même processus qui appelle " |
| 157 |
"B<pthread_join>(3)." |
| 158 |
|
| 159 |
#. type: Plain text |
| 160 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 161 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 162 |
msgid "" |
| 163 |
"It returns from I<start_routine>(). This is equivalent to calling " |
| 164 |
"B<pthread_exit>(3) with the value supplied in the I<return> statement." |
| 165 |
msgstr "" |
| 166 |
"Il sort de la routine I<start_routine>(). C'est équivalent à appeler " |
| 167 |
"B<pthread_exit>(3) avec la valeur fournie à l'instruction I<return>." |
| 168 |
|
| 169 |
#. type: Plain text |
| 170 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 171 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 172 |
msgid "It is canceled (see B<pthread_cancel>(3))." |
| 173 |
msgstr "Il est annulé (voir B<pthread_cancel>(3))." |
| 174 |
|
| 175 |
#. type: Plain text |
| 176 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 177 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 178 |
msgid "" |
| 179 |
"Any of the threads in the process calls B<exit>(3), or the main thread " |
| 180 |
"performs a return from I<main>(). This causes the termination of all " |
| 181 |
"threads in the process." |
| 182 |
msgstr "" |
| 183 |
"Un des threads du processus appelle B<exit>(3) ou le thread principal sort " |
| 184 |
"de la routine I<main>() ce qui entraîne l'arrêt de tous les threads du " |
| 185 |
"processus." |
| 186 |
|
| 187 |
#. type: Plain text |
| 188 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 189 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 190 |
msgid "" |
| 191 |
"The I<attr> argument points to a I<pthread_attr_t> structure whose contents " |
| 192 |
"are used at thread creation time to determine attributes for the new thread; " |
| 193 |
"this structure is initialized using B<pthread_attr_init>(3) and related " |
| 194 |
"functions. If I<attr> is NULL, then the thread is created with default " |
| 195 |
"attributes." |
| 196 |
msgstr "" |
| 197 |
"L'argument I<attr> pointe sur une structure I<pthread_attr_t> dont le " |
| 198 |
"contenu est utilisé pendant la création des threads pour déterminer les " |
| 199 |
"attributs du nouveau thread. Cette structure est initialisée avec " |
| 200 |
"B<pthread_attr_init>(3) et les fonctions similaires. Si I<attr> est NULL, " |
| 201 |
"alors le thread est créé avec les attributs par défaut." |
| 202 |
|
| 203 |
#. type: Plain text |
| 204 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 205 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 206 |
msgid "" |
| 207 |
"Before returning, a successful call to B<pthread_create>() stores the ID of " |
| 208 |
"the new thread in the buffer pointed to by I<thread>; this identifier is " |
| 209 |
"used to refer to the thread in subsequent calls to other pthreads functions." |
| 210 |
msgstr "" |
| 211 |
"Avant de rendre la main, un appel réussi à B<pthread_create>() stocke " |
| 212 |
"l'identifiant du nouveau thread dans le tampon pointé par I<thread>. Cet " |
| 213 |
"identifiant est utilisé pour se référer à ce thread dans les appels " |
| 214 |
"ultérieurs aux autres fonctions de pthreads." |
| 215 |
|
| 216 |
#. type: Plain text |
| 217 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 218 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 219 |
msgid "" |
| 220 |
"The new thread inherits a copy of the creating thread's signal mask " |
| 221 |
"(B<pthread_sigmask>(3)). The set of pending signals for the new thread is " |
| 222 |
"empty (B<sigpending>(2)). The new thread does not inherit the creating " |
| 223 |
"thread's alternate signal stack (B<sigaltstack>(2))." |
| 224 |
msgstr "" |
| 225 |
"Le nouveau thread hérite d'une copie du masque de signal du thread créateur " |
| 226 |
"(B<pthread_sigmask>(3)). L'ensemble des signaux en attente pour le nouveau " |
| 227 |
"thread est vide (B<sigpending>(2)). Le nouveau thread n'hérite pas de la " |
| 228 |
"pile spécifique de signaux (B<sigaltstack>(2)) du thread appelant." |
| 229 |
|
| 230 |
#. type: Plain text |
| 231 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 232 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 233 |
msgid "" |
| 234 |
"The new thread inherits the calling thread's floating-point environment " |
| 235 |
"(B<fenv>(3))." |
| 236 |
msgstr "" |
| 237 |
"Le nouveau thread hérite de l'environnement en virgule flottante " |
| 238 |
"(B<fenv>(3)) du thread appelant." |
| 239 |
|
| 240 |
#. CLOCK_THREAD_CPUTIME_ID in clock_gettime(2) |
| 241 |
#. type: Plain text |
| 242 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 243 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 244 |
msgid "" |
| 245 |
"The initial value of the new thread's CPU-time clock is 0 (see " |
| 246 |
"B<pthread_getcpuclockid>(3))." |
| 247 |
msgstr "" |
| 248 |
"La valeur initiale de l'horloge CPU du nouveau thread est 0 (voir " |
| 249 |
"B<pthread_getcpuclockid>(3))." |
| 250 |
|
| 251 |
#. type: SS |
| 252 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 253 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 254 |
#, no-wrap |
| 255 |
msgid "Linux-specific details" |
| 256 |
msgstr "Détails spécifiques à Linux" |
| 257 |
|
| 258 |
#. type: Plain text |
| 259 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 260 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 261 |
msgid "" |
| 262 |
"The new thread inherits copies of the calling thread's capability sets (see " |
| 263 |
"B<capabilities>(7)) and CPU affinity mask (see B<sched_setaffinity>(2))." |
| 264 |
msgstr "" |
| 265 |
"Le nouveau thread hérite de copies des ensembles des capacités (voir " |
| 266 |
"B<capabilities>(7)) et des masques d'affinité CPU (consultez " |
| 267 |
"B<sched_setaffinity>(2)) du thread appelant." |
| 268 |
|
| 269 |
#. type: SH |
| 270 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 271 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 272 |
#, no-wrap |
| 273 |
msgid "RETURN VALUE" |
| 274 |
msgstr "VALEUR RENVOYÉE" |
| 275 |
|
| 276 |
#. type: Plain text |
| 277 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 278 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 279 |
msgid "" |
| 280 |
"On success, B<pthread_create>() returns 0; on error, it returns an error " |
| 281 |
"number, and the contents of I<*thread> are undefined." |
| 282 |
msgstr "" |
| 283 |
"En cas de réussite, B<pthread_create>() renvoie B<0> ; en cas d'erreur, elle " |
| 284 |
"renvoie un numéro d'erreur, et le contenu de I<*thread> est indéfini." |
| 285 |
|
| 286 |
#. type: SH |
| 287 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 288 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 289 |
#, no-wrap |
| 290 |
msgid "ERRORS" |
| 291 |
msgstr "ERREURS" |
| 292 |
|
| 293 |
#. type: TP |
| 294 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 295 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 296 |
#, no-wrap |
| 297 |
msgid "B<EAGAIN>" |
| 298 |
msgstr "B<EAGAIN>" |
| 299 |
|
| 300 |
#. type: Plain text |
| 301 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 302 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 303 |
msgid "Insufficient resources to create another thread." |
| 304 |
msgstr "Ressources insuffisantes pour créer un nouveau thread." |
| 305 |
|
| 306 |
#. NOTE! The following should match the description in fork(2) |
| 307 |
#. type: Plain text |
| 308 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 309 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 310 |
msgid "" |
| 311 |
"A system-imposed limit on the number of threads was encountered. There are " |
| 312 |
"a number of limits that may trigger this error: the B<RLIMIT_NPROC> soft " |
| 313 |
"resource limit (set via B<setrlimit>(2)), which limits the number of " |
| 314 |
"processes and threads for a real user ID, was reached; the kernel's system-" |
| 315 |
"wide limit on the number of processes and threads, I</proc/sys/kernel/" |
| 316 |
"threads-max>, was reached (see B<proc>(5)); or the maximum number of PIDs, " |
| 317 |
"I</proc/sys/kernel/pid_max>, was reached (see B<proc>(5))." |
| 318 |
msgstr "" |
| 319 |
"Une limite système sur le nombre de threads a été atteinte. Plusieurs " |
| 320 |
"limites pourraient déclencher cette erreur : la limite de ressources souple " |
| 321 |
"B<RLIMIT_NPROC> (définie à l’aide B<setrlimit>(2)), qui limite le nombre de " |
| 322 |
"processus et threads par identifiant d’utilisateur réel, a été atteinte ; " |
| 323 |
"la limite système imposée par le noyau sur le nombre total de processus et " |
| 324 |
"threads, I</proc/sys/kernel/threads-max>, a été atteinte (consultez " |
| 325 |
"B<proc>(5)) ; ou le nombre maximal de PID, I</proc/sys/kernel/pid_max>, a " |
| 326 |
"été atteint (consultez B<proc>(5))." |
| 327 |
|
| 328 |
#. type: TP |
| 329 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 330 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 331 |
#, no-wrap |
| 332 |
msgid "B<EINVAL>" |
| 333 |
msgstr "B<EINVAL>" |
| 334 |
|
| 335 |
#. type: Plain text |
| 336 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 337 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 338 |
msgid "Invalid settings in I<attr>." |
| 339 |
msgstr "Paramètres incorrects dans I<attr>." |
| 340 |
|
| 341 |
#. FIXME . Test the following |
| 342 |
#. type: TP |
| 343 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 344 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 345 |
#, no-wrap |
| 346 |
msgid "B<EPERM>" |
| 347 |
msgstr "B<EPERM>" |
| 348 |
|
| 349 |
#. type: Plain text |
| 350 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 351 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 352 |
msgid "" |
| 353 |
"No permission to set the scheduling policy and parameters specified in " |
| 354 |
"I<attr>." |
| 355 |
msgstr "" |
| 356 |
"Permissions insuffisantes pour définir la politique d'ordonnancement et les " |
| 357 |
"paramètres spécifiés dans I<attr>." |
| 358 |
|
| 359 |
#. type: SH |
| 360 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 361 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 362 |
#, no-wrap |
| 363 |
msgid "ATTRIBUTES" |
| 364 |
msgstr "ATTRIBUTS" |
| 365 |
|
| 366 |
#. type: Plain text |
| 367 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 368 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 369 |
msgid "" |
| 370 |
"For an explanation of the terms used in this section, see B<attributes>(7)." |
| 371 |
msgstr "" |
| 372 |
"Pour une explication des termes utilisés dans cette section, consulter " |
| 373 |
"B<attributes>(7)." |
| 374 |
|
| 375 |
#. type: tbl table |
| 376 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 377 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 378 |
#, no-wrap |
| 379 |
msgid "Interface" |
| 380 |
msgstr "Interface" |
| 381 |
|
| 382 |
#. type: tbl table |
| 383 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 384 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 385 |
#, no-wrap |
| 386 |
msgid "Attribute" |
| 387 |
msgstr "Attribut" |
| 388 |
|
| 389 |
#. type: tbl table |
| 390 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 391 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 392 |
#, no-wrap |
| 393 |
msgid "Value" |
| 394 |
msgstr "Valeur" |
| 395 |
|
| 396 |
#. type: tbl table |
| 397 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 398 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 399 |
#, no-wrap |
| 400 |
msgid ".na\n" |
| 401 |
msgstr ".na\n" |
| 402 |
|
| 403 |
#. type: tbl table |
| 404 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 405 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 406 |
#, no-wrap |
| 407 |
msgid ".nh\n" |
| 408 |
msgstr ".nh\n" |
| 409 |
|
| 410 |
#. type: tbl table |
| 411 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 412 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 413 |
#, no-wrap |
| 414 |
msgid "B<pthread_create>()" |
| 415 |
msgstr "B<pthread_create>()" |
| 416 |
|
| 417 |
#. type: tbl table |
| 418 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 419 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 420 |
#, no-wrap |
| 421 |
msgid "Thread safety" |
| 422 |
msgstr "Sécurité des threads" |
| 423 |
|
| 424 |
#. type: tbl table |
| 425 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 426 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 427 |
#, no-wrap |
| 428 |
msgid "MT-Safe" |
| 429 |
msgstr "MT-Safe" |
| 430 |
|
| 431 |
#. type: SH |
| 432 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 433 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 434 |
#, no-wrap |
| 435 |
msgid "STANDARDS" |
| 436 |
msgstr "NORMES" |
| 437 |
|
| 438 |
#. type: Plain text |
| 439 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 440 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 441 |
msgid "POSIX.1-2008." |
| 442 |
msgstr "POSIX.1-2008." |
| 443 |
|
| 444 |
#. type: SH |
| 445 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 446 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 447 |
#, no-wrap |
| 448 |
msgid "HISTORY" |
| 449 |
msgstr "HISTORIQUE" |
| 450 |
|
| 451 |
#. type: Plain text |
| 452 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 453 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 454 |
msgid "POSIX.1-2001." |
| 455 |
msgstr "POSIX.1-2001." |
| 456 |
|
| 457 |
#. type: SH |
| 458 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 459 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 460 |
#, no-wrap |
| 461 |
msgid "NOTES" |
| 462 |
msgstr "NOTES" |
| 463 |
|
| 464 |
#. type: Plain text |
| 465 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 466 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 467 |
msgid "" |
| 468 |
"See B<pthread_self>(3) for further information on the thread ID returned in " |
| 469 |
"I<*thread> by B<pthread_create>(). Unless real-time scheduling policies are " |
| 470 |
"being employed, after a call to B<pthread_create>(), it is indeterminate " |
| 471 |
"which thread\\[em]the caller or the new thread\\[em]will next execute." |
| 472 |
msgstr "" |
| 473 |
"Consultez B<pthread_self>(3) pour des informations plus détaillées sur " |
| 474 |
"l'identifiant de thread renvoyé dans I<*thread> par B<pthread_create>(). " |
| 475 |
"Sauf si une politique d'ordonnancement temps-réel est employée, après un " |
| 476 |
"appel à B<pthread_create>(), on ne sait pas quel thread \\[em] l'appelant ou " |
| 477 |
"le nouveau thread \\[em] sera exécuté ensuite." |
| 478 |
|
| 479 |
#. type: Plain text |
| 480 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 481 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 482 |
msgid "" |
| 483 |
"A thread may either be I<joinable> or I<detached>. If a thread is joinable, " |
| 484 |
"then another thread can call B<pthread_join>(3) to wait for the thread to " |
| 485 |
"terminate and fetch its exit status. Only when a terminated joinable thread " |
| 486 |
"has been joined are the last of its resources released back to the system. " |
| 487 |
"When a detached thread terminates, its resources are automatically released " |
| 488 |
"back to the system: it is not possible to join with the thread in order to " |
| 489 |
"obtain its exit status. Making a thread detached is useful for some types " |
| 490 |
"of daemon threads whose exit status the application does not need to care " |
| 491 |
"about. By default, a new thread is created in a joinable state, unless " |
| 492 |
"I<attr> was set to create the thread in a detached state (using " |
| 493 |
"B<pthread_attr_setdetachstate>(3))." |
| 494 |
msgstr "" |
| 495 |
"Un thread peut être dans un état soit joignable (I<joinable>), soit détaché " |
| 496 |
"(I<detached>). Si un thread est joignable, un autre thread peut appeler " |
| 497 |
"B<pthread_join>(3) pour attendre que ce thread se termine et récupérer sa " |
| 498 |
"valeur de sortie. Ce n'est que quand un thread terminé et joignable a été " |
| 499 |
"joint que ses ressources sont rendues au système. Quand un thread détaché se " |
| 500 |
"termine, ses ressources sont automatiquement rendues au système\\ : il n'est " |
| 501 |
"pas possible de joindre un tel thread afin d'en obtenir la valeur de sortie. " |
| 502 |
"Mettre un thread dans l'état détaché est pratique pour certains types de " |
| 503 |
"threads de démon dont l'application n'a pas à se préoccuper de la valeur de " |
| 504 |
"sortie. Par défaut, un nouveau thread est créé dans l'état joignable, à " |
| 505 |
"moins qu'I<attr> n'ait été modifié (avec B<pthread_attr_setdetachstate>(3)) " |
| 506 |
"pour créer le thread dans un état détaché." |
| 507 |
|
| 508 |
#. type: Plain text |
| 509 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 510 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 511 |
msgid "" |
| 512 |
"Under the NPTL threading implementation, if the B<RLIMIT_STACK> soft " |
| 513 |
"resource limit I<at the time the program started> has any value other than " |
| 514 |
"\"unlimited\", then it determines the default stack size of new threads. " |
| 515 |
"Using B<pthread_attr_setstacksize>(3), the stack size attribute can be " |
| 516 |
"explicitly set in the I<attr> argument used to create a thread, in order to " |
| 517 |
"obtain a stack size other than the default. If the B<RLIMIT_STACK> resource " |
| 518 |
"limit is set to \"unlimited\", a per-architecture value is used for the " |
| 519 |
"stack size: 2 MB on most architectures; 4 MB on POWER and Sparc-64." |
| 520 |
msgstr "" |
| 521 |
"Avec l'implémentation NPTL, si la limite souple B<RLIMIT_STACK> a une valeur " |
| 522 |
"autre qu'«\\ unlimited\\ » I<au moment où le programme a démarré>, elle " |
| 523 |
"détermine la taille de la pile par défaut pour les nouveaux threads. Afin " |
| 524 |
"d'obtenir une taille de pile différente de la valeur par défaut, il faut " |
| 525 |
"appeler B<pthread_attr_setstacksize>(3) avec la valeur souhaitée sur " |
| 526 |
"l'argument I<attr> utilisé pour créer un thread. Si la limite de ressources " |
| 527 |
"B<RLIMIT_STACK> a la valeur «\\ unlimited\\ », une valeur dépendant de " |
| 528 |
"l'architecture est utilisée pour la taille de la pile : 2 Mo pour la plupart " |
| 529 |
"des architectures ; 4 Mo pour POWER et Sparc-64." |
| 530 |
|
| 531 |
#. type: SH |
| 532 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 533 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 534 |
#, no-wrap |
| 535 |
msgid "BUGS" |
| 536 |
msgstr "BOGUES" |
| 537 |
|
| 538 |
#. type: Plain text |
| 539 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 540 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 541 |
msgid "" |
| 542 |
"In the obsolete LinuxThreads implementation, each of the threads in a " |
| 543 |
"process has a different process ID. This is in violation of the POSIX " |
| 544 |
"threads specification, and is the source of many other nonconformances to " |
| 545 |
"the standard; see B<pthreads>(7)." |
| 546 |
msgstr "" |
| 547 |
"Dans l'implémentation obsolète LinuxThreads, chacun des threads dans un " |
| 548 |
"processus a un identifiant de processus différent, ce qui est en violation " |
| 549 |
"des spécifications POSIX sur les threads et est la cause de nombreuses non-" |
| 550 |
"conformité au standard. Consultez B<pthreads>(7)." |
| 551 |
|
| 552 |
#. type: SH |
| 553 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 554 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 555 |
#, no-wrap |
| 556 |
msgid "EXAMPLES" |
| 557 |
msgstr "EXEMPLES" |
| 558 |
|
| 559 |
#. type: Plain text |
| 560 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 561 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 562 |
msgid "" |
| 563 |
"The program below demonstrates the use of B<pthread_create>(), as well as a " |
| 564 |
"number of other functions in the pthreads API." |
| 565 |
msgstr "" |
| 566 |
"Le programme ci-dessous montre l'utilisation de B<pthread_create>(), ainsi " |
| 567 |
"qu'un certain nombre d'autres fonctions de l'API pthreads." |
| 568 |
|
| 569 |
#. type: Plain text |
| 570 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 571 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 572 |
msgid "" |
| 573 |
"In the following run, on a system providing the NPTL threading " |
| 574 |
"implementation, the stack size defaults to the value given by the \"stack " |
| 575 |
"size\" resource limit:" |
| 576 |
msgstr "" |
| 577 |
"Lors de l'exécution suivante, sur un système avec l'implémentation NPTL, la " |
| 578 |
"taille de la pile vaut par défaut la valeur renvoyée par la limite de la " |
| 579 |
"ressource «\\ stack size\\ » (taille de la pile)\\ :" |
| 580 |
|
| 581 |
#. type: Plain text |
| 582 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 583 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 584 |
#, no-wrap |
| 585 |
msgid "" |
| 586 |
"$B< ulimit -s>\n" |
| 587 |
"8192 # The stack size limit is 8 MB (0x800000 bytes)\n" |
| 588 |
"$B< ./a.out hola salut servus>\n" |
| 589 |
"Thread 1: top of stack near 0xb7dd03b8; argv_string=hola\n" |
| 590 |
"Thread 2: top of stack near 0xb75cf3b8; argv_string=salut\n" |
| 591 |
"Thread 3: top of stack near 0xb6dce3b8; argv_string=servus\n" |
| 592 |
"Joined with thread 1; returned value was HOLA\n" |
| 593 |
"Joined with thread 2; returned value was SALUT\n" |
| 594 |
"Joined with thread 3; returned value was SERVUS\n" |
| 595 |
msgstr "" |
| 596 |
"$B< ulimit -s>\n" |
| 597 |
"8192 # The stack size limit is 8 MB (0x800000 bytes)\n" |
| 598 |
"$B< ./a.out hola salut servus>\n" |
| 599 |
"Thread 1: top of stack near 0xb7dd03b8; argv_string=hola\n" |
| 600 |
"Thread 2: top of stack near 0xb75cf3b8; argv_string=salut\n" |
| 601 |
"Thread 3: top of stack near 0xb6dce3b8; argv_string=servus\n" |
| 602 |
"Joined with thread 1; returned value was HOLA\n" |
| 603 |
"Joined with thread 2; returned value was SALUT\n" |
| 604 |
"Joined with thread 3; returned value was SERVUS\n" |
| 605 |
|
| 606 |
#. type: Plain text |
| 607 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 608 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 609 |
msgid "" |
| 610 |
"In the next run, the program explicitly sets a stack size of 1\\ MB (using " |
| 611 |
"B<pthread_attr_setstacksize>(3)) for the created threads:" |
| 612 |
msgstr "" |
| 613 |
"Lors de l'exécution suivante, le programme définit explicitement une taille " |
| 614 |
"de pile de 1\\ Mo (avec B<pthread_attr_setstacksize>(3)) pour les threads " |
| 615 |
"créés\\ :" |
| 616 |
|
| 617 |
#. type: Plain text |
| 618 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 619 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 620 |
#, no-wrap |
| 621 |
msgid "" |
| 622 |
"$B< ./a.out -s 0x100000 hola salut servus>\n" |
| 623 |
"Thread 1: top of stack near 0xb7d723b8; argv_string=hola\n" |
| 624 |
"Thread 2: top of stack near 0xb7c713b8; argv_string=salut\n" |
| 625 |
"Thread 3: top of stack near 0xb7b703b8; argv_string=servus\n" |
| 626 |
"Joined with thread 1; returned value was HOLA\n" |
| 627 |
"Joined with thread 2; returned value was SALUT\n" |
| 628 |
"Joined with thread 3; returned value was SERVUS\n" |
| 629 |
msgstr "" |
| 630 |
"$B< ./a.out -s 0x100000 hola salut servus>\n" |
| 631 |
"Thread 1: top of stack near 0xb7d723b8; argv_string=hola\n" |
| 632 |
"Thread 2: top of stack near 0xb7c713b8; argv_string=salut\n" |
| 633 |
"Thread 3: top of stack near 0xb7b703b8; argv_string=servus\n" |
| 634 |
"Joined with thread 1; returned value was HOLA\n" |
| 635 |
"Joined with thread 2; returned value was SALUT\n" |
| 636 |
"Joined with thread 3; returned value was SERVUS\n" |
| 637 |
|
| 638 |
#. type: SS |
| 639 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 640 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 641 |
#, no-wrap |
| 642 |
msgid "Program source" |
| 643 |
msgstr "Source du programme" |
| 644 |
|
| 645 |
#. type: Plain text |
| 646 |
#: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1 |
| 647 |
#: opensuse-tumbleweed |
| 648 |
#, fuzzy, no-wrap |
| 649 |
#| msgid "" |
| 650 |
#| "#include E<lt>ctype.hE<gt>\n" |
| 651 |
#| "#include E<lt>errno.hE<gt>\n" |
| 652 |
#| "#include E<lt>pthread.hE<gt>\n" |
| 653 |
#| "#include E<lt>stdio.hE<gt>\n" |
| 654 |
#| "#include E<lt>stdlib.hE<gt>\n" |
| 655 |
#| "#include E<lt>string.hE<gt>\n" |
| 656 |
#| "#include E<lt>sys/types.hE<gt>\n" |
| 657 |
#| "#include E<lt>unistd.hE<gt>\n" |
| 658 |
#| "\\&\n" |
| 659 |
#| "#define handle_error_en(en, msg) \\e\n" |
| 660 |
#| " do { errno = en; perror(msg); exit(EXIT_FAILURE); } while (0)\n" |
| 661 |
#| "\\&\n" |
| 662 |
#| "#define handle_error(msg) \\e\n" |
| 663 |
#| " do { perror(msg); exit(EXIT_FAILURE); } while (0)\n" |
| 664 |
#| "\\&\n" |
| 665 |
#| "struct thread_info { /* Used as argument to thread_start() */\n" |
| 666 |
#| " pthread_t thread_id; /* ID returned by pthread_create() */\n" |
| 667 |
#| " int thread_num; /* Application-defined thread # */\n" |
| 668 |
#| " char *argv_string; /* From command-line argument */\n" |
| 669 |
#| "};\n" |
| 670 |
#| "\\&\n" |
| 671 |
#| "/* Thread start function: display address near top of our stack,\n" |
| 672 |
#| " and return upper-cased copy of argv_string. */\n" |
| 673 |
#| "\\&\n" |
| 674 |
#| "static void *\n" |
| 675 |
#| "thread_start(void *arg)\n" |
| 676 |
#| "{\n" |
| 677 |
#| " struct thread_info *tinfo = arg;\n" |
| 678 |
#| " char *uargv;\n" |
| 679 |
#| "\\&\n" |
| 680 |
#| " printf(\"Thread %d: top of stack near %p; argv_string=%s\\en\",\n" |
| 681 |
#| " tinfo-E<gt>thread_num, (void *) &tinfo, tinfo-E<gt>argv_string);\n" |
| 682 |
#| "\\&\n" |
| 683 |
#| " uargv = strdup(tinfo-E<gt>argv_string);\n" |
| 684 |
#| " if (uargv == NULL)\n" |
| 685 |
#| " handle_error(\"strdup\");\n" |
| 686 |
#| "\\&\n" |
| 687 |
#| " for (char *p = uargv; *p != \\[aq]\\e0\\[aq]; p++)\n" |
| 688 |
#| " *p = toupper(*p);\n" |
| 689 |
#| "\\&\n" |
| 690 |
#| " return uargv;\n" |
| 691 |
#| "}\n" |
| 692 |
#| "\\&\n" |
| 693 |
#| "int\n" |
| 694 |
#| "main(int argc, char *argv[])\n" |
| 695 |
#| "{\n" |
| 696 |
#| " int s, opt;\n" |
| 697 |
#| " void *res;\n" |
| 698 |
#| " size_t num_threads;\n" |
| 699 |
#| " ssize_t stack_size;\n" |
| 700 |
#| " pthread_attr_t attr;\n" |
| 701 |
#| " struct thread_info *tinfo;\n" |
| 702 |
#| "\\&\n" |
| 703 |
#| " /* The \"-s\" option specifies a stack size for our threads. */\n" |
| 704 |
#| "\\&\n" |
| 705 |
#| " stack_size = -1;\n" |
| 706 |
#| " while ((opt = getopt(argc, argv, \"s:\")) != -1) {\n" |
| 707 |
#| " switch (opt) {\n" |
| 708 |
#| " case \\[aq]s\\[aq]:\n" |
| 709 |
#| " stack_size = strtoul(optarg, NULL, 0);\n" |
| 710 |
#| " break;\n" |
| 711 |
#| "\\&\n" |
| 712 |
#| " default:\n" |
| 713 |
#| " fprintf(stderr, \"Usage: %s [-s stack-size] arg...\\en\",\n" |
| 714 |
#| " argv[0]);\n" |
| 715 |
#| " exit(EXIT_FAILURE);\n" |
| 716 |
#| " }\n" |
| 717 |
#| " }\n" |
| 718 |
#| "\\&\n" |
| 719 |
#| " num_threads = argc - optind;\n" |
| 720 |
#| "\\&\n" |
| 721 |
#| " /* Initialize thread creation attributes. */\n" |
| 722 |
#| "\\&\n" |
| 723 |
#| " s = pthread_attr_init(&attr);\n" |
| 724 |
#| " if (s != 0)\n" |
| 725 |
#| " handle_error_en(s, \"pthread_attr_init\");\n" |
| 726 |
#| "\\&\n" |
| 727 |
#| " if (stack_size E<gt> 0) {\n" |
| 728 |
#| " s = pthread_attr_setstacksize(&attr, stack_size);\n" |
| 729 |
#| " if (s != 0)\n" |
| 730 |
#| " handle_error_en(s, \"pthread_attr_setstacksize\");\n" |
| 731 |
#| " }\n" |
| 732 |
#| "\\&\n" |
| 733 |
#| " /* Allocate memory for pthread_create() arguments. */\n" |
| 734 |
#| "\\&\n" |
| 735 |
#| " tinfo = calloc(num_threads, sizeof(*tinfo));\n" |
| 736 |
#| " if (tinfo == NULL)\n" |
| 737 |
#| " handle_error(\"calloc\");\n" |
| 738 |
#| "\\&\n" |
| 739 |
#| " /* Create one thread for each command-line argument. */\n" |
| 740 |
#| "\\&\n" |
| 741 |
#| " for (size_t tnum = 0; tnum E<lt> num_threads; tnum++) {\n" |
| 742 |
#| " tinfo[tnum].thread_num = tnum + 1;\n" |
| 743 |
#| " tinfo[tnum].argv_string = argv[optind + tnum];\n" |
| 744 |
#| "\\&\n" |
| 745 |
#| " /* The pthread_create() call stores the thread ID into\n" |
| 746 |
#| " corresponding element of tinfo[]. */\n" |
| 747 |
#| "\\&\n" |
| 748 |
#| " s = pthread_create(&tinfo[tnum].thread_id, &attr,\n" |
| 749 |
#| " &thread_start, &tinfo[tnum]);\n" |
| 750 |
#| " if (s != 0)\n" |
| 751 |
#| " handle_error_en(s, \"pthread_create\");\n" |
| 752 |
#| " }\n" |
| 753 |
#| "\\&\n" |
| 754 |
#| " /* Destroy the thread attributes object, since it is no\n" |
| 755 |
#| " longer needed. */\n" |
| 756 |
#| "\\&\n" |
| 757 |
#| " s = pthread_attr_destroy(&attr);\n" |
| 758 |
#| " if (s != 0)\n" |
| 759 |
#| " handle_error_en(s, \"pthread_attr_destroy\");\n" |
| 760 |
#| "\\&\n" |
| 761 |
#| " /* Now join with each thread, and display its returned value. */\n" |
| 762 |
#| "\\&\n" |
| 763 |
#| " for (size_t tnum = 0; tnum E<lt> num_threads; tnum++) {\n" |
| 764 |
#| " s = pthread_join(tinfo[tnum].thread_id, &res);\n" |
| 765 |
#| " if (s != 0)\n" |
| 766 |
#| " handle_error_en(s, \"pthread_join\");\n" |
| 767 |
#| "\\&\n" |
| 768 |
#| " printf(\"Joined with thread %d; returned value was %s\\en\",\n" |
| 769 |
#| " tinfo[tnum].thread_num, (char *) res);\n" |
| 770 |
#| " free(res); /* Free memory allocated by thread */\n" |
| 771 |
#| " }\n" |
| 772 |
#| "\\&\n" |
| 773 |
#| " free(tinfo);\n" |
| 774 |
#| " exit(EXIT_SUCCESS);\n" |
| 775 |
#| "}\n" |
| 776 |
msgid "" |
| 777 |
"#include E<lt>ctype.hE<gt>\n" |
| 778 |
"#include E<lt>err.hE<gt>\n" |
| 779 |
"#include E<lt>pthread.hE<gt>\n" |
| 780 |
"#include E<lt>stdio.hE<gt>\n" |
| 781 |
"#include E<lt>stdlib.hE<gt>\n" |
| 782 |
"#include E<lt>string.hE<gt>\n" |
| 783 |
"#include E<lt>sys/types.hE<gt>\n" |
| 784 |
"#include E<lt>unistd.hE<gt>\n" |
| 785 |
"\\&\n" |
| 786 |
"struct thread_info { /* Used as argument to thread_start() */\n" |
| 787 |
" pthread_t thread_id; /* ID returned by pthread_create() */\n" |
| 788 |
" int thread_num; /* Application-defined thread # */\n" |
| 789 |
" char *argv_string; /* From command-line argument */\n" |
| 790 |
"};\n" |
| 791 |
"\\&\n" |
| 792 |
"/* Thread start function: display address near top of our stack,\n" |
| 793 |
" and return upper-cased copy of argv_string. */\n" |
| 794 |
"\\&\n" |
| 795 |
"static void *\n" |
| 796 |
"thread_start(void *arg)\n" |
| 797 |
"{\n" |
| 798 |
" struct thread_info *tinfo = arg;\n" |
| 799 |
" char *uargv;\n" |
| 800 |
"\\&\n" |
| 801 |
" printf(\"Thread %d: top of stack near %p; argv_string=%s\\[rs]n\",\n" |
| 802 |
" tinfo-E<gt>thread_num, (void *) &tinfo, tinfo-E<gt>argv_string);\n" |
| 803 |
"\\&\n" |
| 804 |
" uargv = strdup(tinfo-E<gt>argv_string);\n" |
| 805 |
" if (uargv == NULL)\n" |
| 806 |
" err(EXIT_FAILURE, \"strdup\");\n" |
| 807 |
"\\&\n" |
| 808 |
" for (char *p = uargv; *p != \\[aq]\\[rs]0\\[aq]; p++)\n" |
| 809 |
" *p = toupper(*p);\n" |
| 810 |
"\\&\n" |
| 811 |
" return uargv;\n" |
| 812 |
"}\n" |
| 813 |
"\\&\n" |
| 814 |
"int\n" |
| 815 |
"main(int argc, char *argv[])\n" |
| 816 |
"{\n" |
| 817 |
" int s, opt;\n" |
| 818 |
" void *res;\n" |
| 819 |
" size_t num_threads;\n" |
| 820 |
" ssize_t stack_size;\n" |
| 821 |
" pthread_attr_t attr;\n" |
| 822 |
" struct thread_info *tinfo;\n" |
| 823 |
"\\&\n" |
| 824 |
" /* The \"-s\" option specifies a stack size for our threads. */\n" |
| 825 |
"\\&\n" |
| 826 |
" stack_size = -1;\n" |
| 827 |
" while ((opt = getopt(argc, argv, \"s:\")) != -1) {\n" |
| 828 |
" switch (opt) {\n" |
| 829 |
" case \\[aq]s\\[aq]:\n" |
| 830 |
" stack_size = strtoul(optarg, NULL, 0);\n" |
| 831 |
" break;\n" |
| 832 |
"\\&\n" |
| 833 |
" default:\n" |
| 834 |
" fprintf(stderr, \"Usage: %s [-s stack-size] arg...\\[rs]n\",\n" |
| 835 |
" argv[0]);\n" |
| 836 |
" exit(EXIT_FAILURE);\n" |
| 837 |
" }\n" |
| 838 |
" }\n" |
| 839 |
"\\&\n" |
| 840 |
" num_threads = argc - optind;\n" |
| 841 |
"\\&\n" |
| 842 |
" /* Initialize thread creation attributes. */\n" |
| 843 |
"\\&\n" |
| 844 |
" s = pthread_attr_init(&attr);\n" |
| 845 |
" if (s != 0)\n" |
| 846 |
" errc(EXIT_FAILURE, s, \"pthread_attr_init\");\n" |
| 847 |
"\\&\n" |
| 848 |
" if (stack_size E<gt> 0) {\n" |
| 849 |
" s = pthread_attr_setstacksize(&attr, stack_size);\n" |
| 850 |
" if (s != 0)\n" |
| 851 |
" errc(EXIT_FAILURE, s, \"pthread_attr_setstacksize\");\n" |
| 852 |
" }\n" |
| 853 |
"\\&\n" |
| 854 |
" /* Allocate memory for pthread_create() arguments. */\n" |
| 855 |
"\\&\n" |
| 856 |
" tinfo = calloc(num_threads, sizeof(*tinfo));\n" |
| 857 |
" if (tinfo == NULL)\n" |
| 858 |
" err(EXIT_FAILURE, \"calloc\");\n" |
| 859 |
"\\&\n" |
| 860 |
" /* Create one thread for each command-line argument. */\n" |
| 861 |
"\\&\n" |
| 862 |
" for (size_t tnum = 0; tnum E<lt> num_threads; tnum++) {\n" |
| 863 |
" tinfo[tnum].thread_num = tnum + 1;\n" |
| 864 |
" tinfo[tnum].argv_string = argv[optind + tnum];\n" |
| 865 |
"\\&\n" |
| 866 |
" /* The pthread_create() call stores the thread ID into\n" |
| 867 |
" corresponding element of tinfo[]. */\n" |
| 868 |
"\\&\n" |
| 869 |
" s = pthread_create(&tinfo[tnum].thread_id, &attr,\n" |
| 870 |
" &thread_start, &tinfo[tnum]);\n" |
| 871 |
" if (s != 0)\n" |
| 872 |
" errc(EXIT_FAILURE, s, \"pthread_create\");\n" |
| 873 |
" }\n" |
| 874 |
"\\&\n" |
| 875 |
" /* Destroy the thread attributes object, since it is no\n" |
| 876 |
" longer needed. */\n" |
| 877 |
"\\&\n" |
| 878 |
" s = pthread_attr_destroy(&attr);\n" |
| 879 |
" if (s != 0)\n" |
| 880 |
" errc(EXIT_FAILURE, s, \"pthread_attr_destroy\");\n" |
| 881 |
"\\&\n" |
| 882 |
" /* Now join with each thread, and display its returned value. */\n" |
| 883 |
"\\&\n" |
| 884 |
" for (size_t tnum = 0; tnum E<lt> num_threads; tnum++) {\n" |
| 885 |
" s = pthread_join(tinfo[tnum].thread_id, &res);\n" |
| 886 |
" if (s != 0)\n" |
| 887 |
" errc(EXIT_FAILURE, s, \"pthread_join\");\n" |
| 888 |
"\\&\n" |
| 889 |
" printf(\"Joined with thread %d; returned value was %s\\[rs]n\",\n" |
| 890 |
" tinfo[tnum].thread_num, (char *) res);\n" |
| 891 |
" free(res); /* Free memory allocated by thread */\n" |
| 892 |
" }\n" |
| 893 |
"\\&\n" |
| 894 |
" free(tinfo);\n" |
| 895 |
" exit(EXIT_SUCCESS);\n" |
| 896 |
"}\n" |
| 897 |
msgstr "" |
| 898 |
"#include E<lt>ctype.hE<gt>\n" |
| 899 |
"#include E<lt>errno.hE<gt>\n" |
| 900 |
"#include E<lt>pthread.hE<gt>\n" |
| 901 |
"#include E<lt>stdio.hE<gt>\n" |
| 902 |
"#include E<lt>stdlib.hE<gt>\n" |
| 903 |
"#include E<lt>string.hE<gt>\n" |
| 904 |
"#include E<lt>sys/types.hE<gt>\n" |
| 905 |
"#include E<lt>unistd.hE<gt>\n" |
| 906 |
"\\&\n" |
| 907 |
"#define handle_error_en(en, msg) \\e\n" |
| 908 |
" do { errno = en; perror(msg); exit(EXIT_FAILURE); } while (0)\n" |
| 909 |
"\\&\n" |
| 910 |
"#define handle_error(msg) \\e\n" |
| 911 |
" do { perror(msg); exit(EXIT_FAILURE); } while (0)\n" |
| 912 |
"\\&\n" |
| 913 |
"struct thread_info { /* Utilisé comme argument pour thread_start() */\n" |
| 914 |
" pthread_t thread_id; /* Identifiant renvoyé par pthread_create() */\n" |
| 915 |
" int thread_num; /* N° de thread défini par l'application */\n" |
| 916 |
" char *argv_string; /* À partir de l'argument en ligne de commande */\n" |
| 917 |
"};\n" |
| 918 |
"\\&\n" |
| 919 |
"/* Fonction de démarrage du thread : affiche l'adresse vers le haut de la pile,\n" |
| 920 |
" et renvoie une copie en majuscule de argv_string. */\n" |
| 921 |
"\\&\n" |
| 922 |
"static void *\n" |
| 923 |
"thread_start(void *arg)\n" |
| 924 |
"{\n" |
| 925 |
" struct thread_info *tinfo = arg;\n" |
| 926 |
" char *uargv;\n" |
| 927 |
"\\&\n" |
| 928 |
" printf(\"Thread %d : sommet de la pile près de %p; argv_string=%s\\en\",\n" |
| 929 |
" tinfo-E<gt>thread_num, (void *) &tinfo, tinfo-E<gt>argv_string);\n" |
| 930 |
"\\&\n" |
| 931 |
" uargv = strdup(tinfo-E<gt>argv_string);\n" |
| 932 |
" if (uargv == NULL)\n" |
| 933 |
" handle_error(\"strdup\");\n" |
| 934 |
"\\&\n" |
| 935 |
" for (char *p = uargv; *p != \\[aq]\\e0\\[aq]; p++)\n" |
| 936 |
" *p = toupper(*p);\n" |
| 937 |
"\\&\n" |
| 938 |
" return uargv;\n" |
| 939 |
"}\n" |
| 940 |
"\\&\n" |
| 941 |
"int\n" |
| 942 |
"main(int argc, char *argv[])\n" |
| 943 |
"{\n" |
| 944 |
" int s, opt;\n" |
| 945 |
" void *res;\n" |
| 946 |
" size_t num_threads;\n" |
| 947 |
" ssize_t stack_size;\n" |
| 948 |
" pthread_attr_t attr;\n" |
| 949 |
" struct thread_info *tinfo;\n" |
| 950 |
"\\&\n" |
| 951 |
" /* L'option \"-s\" spécifie une taille de pile pour les threads. */\n" |
| 952 |
"\\&\n" |
| 953 |
" stack_size = -1;\n" |
| 954 |
" while ((opt = getopt(argc, argv, \"s:\")) != -1) {\n" |
| 955 |
" switch (opt) {\n" |
| 956 |
" case \\[aq]s\\[aq]:\n" |
| 957 |
" stack_size = strtoul(optarg, NULL, 0);\n" |
| 958 |
" break;\n" |
| 959 |
"\\&\n" |
| 960 |
" default:\n" |
| 961 |
" fprintf(stderr, \"Usage : %s [-s stack-size] arg...\\en\",\n" |
| 962 |
" argv[0]);\n" |
| 963 |
" exit(EXIT_FAILURE);\n" |
| 964 |
" }\n" |
| 965 |
" }\n" |
| 966 |
"\\&\n" |
| 967 |
" num_threads = argc - optind;\n" |
| 968 |
"\\&\n" |
| 969 |
" /* Initialiser les attributs de création de thread. */\n" |
| 970 |
"\\&\n" |
| 971 |
" s = pthread_attr_init(&attr);\n" |
| 972 |
" if (s != 0)\n" |
| 973 |
" handle_error_en(s, \"pthread_attr_init\");\n" |
| 974 |
"\\&\n" |
| 975 |
" if (stack_size E<gt> 0) {\n" |
| 976 |
" s = pthread_attr_setstacksize(&attr, stack_size);\n" |
| 977 |
" if (s != 0)\n" |
| 978 |
" handle_error_en(s, \"pthread_attr_setstacksize\");\n" |
| 979 |
" }\n" |
| 980 |
"\\&\n" |
| 981 |
" /* Allouer la mémoire pour les arguments de pthread_create(). */\n" |
| 982 |
"\\&\n" |
| 983 |
" tinfo = calloc(num_threads, sizeof(*tinfo));\n" |
| 984 |
" if (tinfo == NULL)\n" |
| 985 |
" handle_error(\"calloc\");\n" |
| 986 |
"\\&\n" |
| 987 |
" /* Créer un thread pour chaque argument en ligne de commande. */\n" |
| 988 |
"\\&\n" |
| 989 |
" for (size_t tnum = 0; tnum E<lt> num_threads; tnum++) {\n" |
| 990 |
" tinfo[tnum].thread_num = tnum + 1;\n" |
| 991 |
" tinfo[tnum].argv_string = argv[optind + tnum];\n" |
| 992 |
"\\&\n" |
| 993 |
" /* L'appel pthread_create() stocke l'identifiant du thread dans\n" |
| 994 |
" l'élément correspondant de tinfo[]. */\n" |
| 995 |
"\\&\n" |
| 996 |
" s = pthread_create(&tinfo[tnum].thread_id, &attr,\n" |
| 997 |
" &thread_start, &tinfo[tnum]);\n" |
| 998 |
" if (s != 0)\n" |
| 999 |
" handle_error_en(s, \"pthread_create\");\n" |
| 1000 |
" }\n" |
| 1001 |
"\\&\n" |
| 1002 |
" /* Détruire l'objet des attributs du thread dans la mesure où\n" |
| 1003 |
" il n'est plus nécessaire. */\n" |
| 1004 |
"\\&\n" |
| 1005 |
" s = pthread_attr_destroy(&attr);\n" |
| 1006 |
" if (s != 0)\n" |
| 1007 |
" handle_error_en(s, \"pthread_attr_destroy\");\n" |
| 1008 |
"\\&\n" |
| 1009 |
" /* Maintenant joindre chaque thread et afficher la valeur qu'il renvoie. */\n" |
| 1010 |
"\\&\n" |
| 1011 |
" for (size_t tnum = 0; tnum E<lt> num_threads; tnum++) {\n" |
| 1012 |
" s = pthread_join(tinfo[tnum].thread_id, &res);\n" |
| 1013 |
" if (s != 0)\n" |
| 1014 |
" handle_error_en(s, \"pthread_join\");\n" |
| 1015 |
"\\&\n" |
| 1016 |
" printf(\"Thread joint %d ; la valeur renvoyée est %s\\en\",\n" |
| 1017 |
" tinfo[tnum].thread_num, (char *) res);\n" |
| 1018 |
" free(res); /* Libérer la mémoire allouée par thread */\n" |
| 1019 |
" }\n" |
| 1020 |
"\\&\n" |
| 1021 |
" free(tinfo);\n" |
| 1022 |
" exit(EXIT_SUCCESS);\n" |
| 1023 |
"}\n" |
| 1024 |
|
| 1025 |
#. SRC END |
| 1026 |
#. type: SH |
| 1027 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 1028 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 1029 |
#, no-wrap |
| 1030 |
msgid "SEE ALSO" |
| 1031 |
msgstr "VOIR AUSSI" |
| 1032 |
|
| 1033 |
#. type: Plain text |
| 1034 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 1035 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 1036 |
msgid "" |
| 1037 |
"B<getrlimit>(2), B<pthread_attr_init>(3), B<pthread_cancel>(3), " |
| 1038 |
"B<pthread_detach>(3), B<pthread_equal>(3), B<pthread_exit>(3), " |
| 1039 |
"B<pthread_getattr_np>(3), B<pthread_join>(3), B<pthread_self>(3), " |
| 1040 |
"B<pthread_setattr_default_np>(3), B<pthreads>(7)" |
| 1041 |
msgstr "" |
| 1042 |
"B<getrlimit>(2), B<pthread_attr_init>(3), B<pthread_cancel>(3), " |
| 1043 |
"B<pthread_detach>(3), B<pthread_equal>(3), B<pthread_exit>(3), " |
| 1044 |
"B<pthread_getattr_np>(3), B<pthread_join>(3), B<pthread_self>(3), " |
| 1045 |
"B<pthread_setattr_default_np>(3), B<pthreads>(7)" |
| 1046 |
|
| 1047 |
#. type: TH |
| 1048 |
#: debian-trixie |
| 1049 |
#, no-wrap |
| 1050 |
msgid "2024-06-15" |
| 1051 |
msgstr "15 juin 2024" |
| 1052 |
|
| 1053 |
#. type: TH |
| 1054 |
#: debian-trixie |
| 1055 |
#, no-wrap |
| 1056 |
msgid "Linux man-pages 6.9.1" |
| 1057 |
msgstr "Pages du manuel de Linux 6.9.1" |
| 1058 |
|
| 1059 |
#. type: Plain text |
| 1060 |
#: debian-trixie |
| 1061 |
msgid "POSIX threads library (I<libpthread>, I<-lpthread>)" |
| 1062 |
msgstr "Bibliothèque de threads POSIX (I<libpthread>, I<-lpthread>)" |
| 1063 |
|
| 1064 |
#. type: Plain text |
| 1065 |
#: debian-trixie |
| 1066 |
#, no-wrap |
| 1067 |
msgid "" |
| 1068 |
"B<int pthread_create(pthread_t *restrict >I<thread>B<,>\n" |
| 1069 |
"B< const pthread_attr_t *restrict >I<attr>B<,>\n" |
| 1070 |
"B< void *(*>I<start_routine>B<)(void *),>\n" |
| 1071 |
"B< void *restrict >I<arg>B<);>\n" |
| 1072 |
msgstr "" |
| 1073 |
"B<int pthread_create(pthread_t *restrict >I<thread>B<,>\n" |
| 1074 |
"B< const pthread_attr_t *restrict >I<attr>B<,>\n" |
| 1075 |
"B< void *(*>I<start_routine>B<)(void *),>\n" |
| 1076 |
"B< void *restrict >I<arg>B<);>\n" |
| 1077 |
|
| 1078 |
#. type: Plain text |
| 1079 |
#: debian-trixie fedora-44 fedora-rawhide |
| 1080 |
#, fuzzy, no-wrap |
| 1081 |
#| msgid "" |
| 1082 |
#| "#include E<lt>ctype.hE<gt>\n" |
| 1083 |
#| "#include E<lt>errno.hE<gt>\n" |
| 1084 |
#| "#include E<lt>pthread.hE<gt>\n" |
| 1085 |
#| "#include E<lt>stdio.hE<gt>\n" |
| 1086 |
#| "#include E<lt>stdlib.hE<gt>\n" |
| 1087 |
#| "#include E<lt>string.hE<gt>\n" |
| 1088 |
#| "#include E<lt>sys/types.hE<gt>\n" |
| 1089 |
#| "#include E<lt>unistd.hE<gt>\n" |
| 1090 |
#| "\\&\n" |
| 1091 |
#| "#define handle_error_en(en, msg) \\e\n" |
| 1092 |
#| " do { errno = en; perror(msg); exit(EXIT_FAILURE); } while (0)\n" |
| 1093 |
#| "\\&\n" |
| 1094 |
#| "#define handle_error(msg) \\e\n" |
| 1095 |
#| " do { perror(msg); exit(EXIT_FAILURE); } while (0)\n" |
| 1096 |
#| "\\&\n" |
| 1097 |
#| "struct thread_info { /* Used as argument to thread_start() */\n" |
| 1098 |
#| " pthread_t thread_id; /* ID returned by pthread_create() */\n" |
| 1099 |
#| " int thread_num; /* Application-defined thread # */\n" |
| 1100 |
#| " char *argv_string; /* From command-line argument */\n" |
| 1101 |
#| "};\n" |
| 1102 |
#| "\\&\n" |
| 1103 |
#| "/* Thread start function: display address near top of our stack,\n" |
| 1104 |
#| " and return upper-cased copy of argv_string. */\n" |
| 1105 |
#| "\\&\n" |
| 1106 |
#| "static void *\n" |
| 1107 |
#| "thread_start(void *arg)\n" |
| 1108 |
#| "{\n" |
| 1109 |
#| " struct thread_info *tinfo = arg;\n" |
| 1110 |
#| " char *uargv;\n" |
| 1111 |
#| "\\&\n" |
| 1112 |
#| " printf(\"Thread %d: top of stack near %p; argv_string=%s\\en\",\n" |
| 1113 |
#| " tinfo-E<gt>thread_num, (void *) &tinfo, tinfo-E<gt>argv_string);\n" |
| 1114 |
#| "\\&\n" |
| 1115 |
#| " uargv = strdup(tinfo-E<gt>argv_string);\n" |
| 1116 |
#| " if (uargv == NULL)\n" |
| 1117 |
#| " handle_error(\"strdup\");\n" |
| 1118 |
#| "\\&\n" |
| 1119 |
#| " for (char *p = uargv; *p != \\[aq]\\e0\\[aq]; p++)\n" |
| 1120 |
#| " *p = toupper(*p);\n" |
| 1121 |
#| "\\&\n" |
| 1122 |
#| " return uargv;\n" |
| 1123 |
#| "}\n" |
| 1124 |
#| "\\&\n" |
| 1125 |
#| "int\n" |
| 1126 |
#| "main(int argc, char *argv[])\n" |
| 1127 |
#| "{\n" |
| 1128 |
#| " int s, opt;\n" |
| 1129 |
#| " void *res;\n" |
| 1130 |
#| " size_t num_threads;\n" |
| 1131 |
#| " ssize_t stack_size;\n" |
| 1132 |
#| " pthread_attr_t attr;\n" |
| 1133 |
#| " struct thread_info *tinfo;\n" |
| 1134 |
#| "\\&\n" |
| 1135 |
#| " /* The \"-s\" option specifies a stack size for our threads. */\n" |
| 1136 |
#| "\\&\n" |
| 1137 |
#| " stack_size = -1;\n" |
| 1138 |
#| " while ((opt = getopt(argc, argv, \"s:\")) != -1) {\n" |
| 1139 |
#| " switch (opt) {\n" |
| 1140 |
#| " case \\[aq]s\\[aq]:\n" |
| 1141 |
#| " stack_size = strtoul(optarg, NULL, 0);\n" |
| 1142 |
#| " break;\n" |
| 1143 |
#| "\\&\n" |
| 1144 |
#| " default:\n" |
| 1145 |
#| " fprintf(stderr, \"Usage: %s [-s stack-size] arg...\\en\",\n" |
| 1146 |
#| " argv[0]);\n" |
| 1147 |
#| " exit(EXIT_FAILURE);\n" |
| 1148 |
#| " }\n" |
| 1149 |
#| " }\n" |
| 1150 |
#| "\\&\n" |
| 1151 |
#| " num_threads = argc - optind;\n" |
| 1152 |
#| "\\&\n" |
| 1153 |
#| " /* Initialize thread creation attributes. */\n" |
| 1154 |
#| "\\&\n" |
| 1155 |
#| " s = pthread_attr_init(&attr);\n" |
| 1156 |
#| " if (s != 0)\n" |
| 1157 |
#| " handle_error_en(s, \"pthread_attr_init\");\n" |
| 1158 |
#| "\\&\n" |
| 1159 |
#| " if (stack_size E<gt> 0) {\n" |
| 1160 |
#| " s = pthread_attr_setstacksize(&attr, stack_size);\n" |
| 1161 |
#| " if (s != 0)\n" |
| 1162 |
#| " handle_error_en(s, \"pthread_attr_setstacksize\");\n" |
| 1163 |
#| " }\n" |
| 1164 |
#| "\\&\n" |
| 1165 |
#| " /* Allocate memory for pthread_create() arguments. */\n" |
| 1166 |
#| "\\&\n" |
| 1167 |
#| " tinfo = calloc(num_threads, sizeof(*tinfo));\n" |
| 1168 |
#| " if (tinfo == NULL)\n" |
| 1169 |
#| " handle_error(\"calloc\");\n" |
| 1170 |
#| "\\&\n" |
| 1171 |
#| " /* Create one thread for each command-line argument. */\n" |
| 1172 |
#| "\\&\n" |
| 1173 |
#| " for (size_t tnum = 0; tnum E<lt> num_threads; tnum++) {\n" |
| 1174 |
#| " tinfo[tnum].thread_num = tnum + 1;\n" |
| 1175 |
#| " tinfo[tnum].argv_string = argv[optind + tnum];\n" |
| 1176 |
#| "\\&\n" |
| 1177 |
#| " /* The pthread_create() call stores the thread ID into\n" |
| 1178 |
#| " corresponding element of tinfo[]. */\n" |
| 1179 |
#| "\\&\n" |
| 1180 |
#| " s = pthread_create(&tinfo[tnum].thread_id, &attr,\n" |
| 1181 |
#| " &thread_start, &tinfo[tnum]);\n" |
| 1182 |
#| " if (s != 0)\n" |
| 1183 |
#| " handle_error_en(s, \"pthread_create\");\n" |
| 1184 |
#| " }\n" |
| 1185 |
#| "\\&\n" |
| 1186 |
#| " /* Destroy the thread attributes object, since it is no\n" |
| 1187 |
#| " longer needed. */\n" |
| 1188 |
#| "\\&\n" |
| 1189 |
#| " s = pthread_attr_destroy(&attr);\n" |
| 1190 |
#| " if (s != 0)\n" |
| 1191 |
#| " handle_error_en(s, \"pthread_attr_destroy\");\n" |
| 1192 |
#| "\\&\n" |
| 1193 |
#| " /* Now join with each thread, and display its returned value. */\n" |
| 1194 |
#| "\\&\n" |
| 1195 |
#| " for (size_t tnum = 0; tnum E<lt> num_threads; tnum++) {\n" |
| 1196 |
#| " s = pthread_join(tinfo[tnum].thread_id, &res);\n" |
| 1197 |
#| " if (s != 0)\n" |
| 1198 |
#| " handle_error_en(s, \"pthread_join\");\n" |
| 1199 |
#| "\\&\n" |
| 1200 |
#| " printf(\"Joined with thread %d; returned value was %s\\en\",\n" |
| 1201 |
#| " tinfo[tnum].thread_num, (char *) res);\n" |
| 1202 |
#| " free(res); /* Free memory allocated by thread */\n" |
| 1203 |
#| " }\n" |
| 1204 |
#| "\\&\n" |
| 1205 |
#| " free(tinfo);\n" |
| 1206 |
#| " exit(EXIT_SUCCESS);\n" |
| 1207 |
#| "}\n" |
| 1208 |
msgid "" |
| 1209 |
"#include E<lt>ctype.hE<gt>\n" |
| 1210 |
"#include E<lt>errno.hE<gt>\n" |
| 1211 |
"#include E<lt>pthread.hE<gt>\n" |
| 1212 |
"#include E<lt>stdio.hE<gt>\n" |
| 1213 |
"#include E<lt>stdlib.hE<gt>\n" |
| 1214 |
"#include E<lt>string.hE<gt>\n" |
| 1215 |
"#include E<lt>sys/types.hE<gt>\n" |
| 1216 |
"#include E<lt>unistd.hE<gt>\n" |
| 1217 |
"\\&\n" |
| 1218 |
"#define handle_error_en(en, msg) \\[rs]\n" |
| 1219 |
" do { errno = en; perror(msg); exit(EXIT_FAILURE); } while (0)\n" |
| 1220 |
"\\&\n" |
| 1221 |
"#define handle_error(msg) \\[rs]\n" |
| 1222 |
" do { perror(msg); exit(EXIT_FAILURE); } while (0)\n" |
| 1223 |
"\\&\n" |
| 1224 |
"struct thread_info { /* Used as argument to thread_start() */\n" |
| 1225 |
" pthread_t thread_id; /* ID returned by pthread_create() */\n" |
| 1226 |
" int thread_num; /* Application-defined thread # */\n" |
| 1227 |
" char *argv_string; /* From command-line argument */\n" |
| 1228 |
"};\n" |
| 1229 |
"\\&\n" |
| 1230 |
"/* Thread start function: display address near top of our stack,\n" |
| 1231 |
" and return upper-cased copy of argv_string. */\n" |
| 1232 |
"\\&\n" |
| 1233 |
"static void *\n" |
| 1234 |
"thread_start(void *arg)\n" |
| 1235 |
"{\n" |
| 1236 |
" struct thread_info *tinfo = arg;\n" |
| 1237 |
" char *uargv;\n" |
| 1238 |
"\\&\n" |
| 1239 |
" printf(\"Thread %d: top of stack near %p; argv_string=%s\\[rs]n\",\n" |
| 1240 |
" tinfo-E<gt>thread_num, (void *) &tinfo, tinfo-E<gt>argv_string);\n" |
| 1241 |
"\\&\n" |
| 1242 |
" uargv = strdup(tinfo-E<gt>argv_string);\n" |
| 1243 |
" if (uargv == NULL)\n" |
| 1244 |
" handle_error(\"strdup\");\n" |
| 1245 |
"\\&\n" |
| 1246 |
" for (char *p = uargv; *p != \\[aq]\\[rs]0\\[aq]; p++)\n" |
| 1247 |
" *p = toupper(*p);\n" |
| 1248 |
"\\&\n" |
| 1249 |
" return uargv;\n" |
| 1250 |
"}\n" |
| 1251 |
"\\&\n" |
| 1252 |
"int\n" |
| 1253 |
"main(int argc, char *argv[])\n" |
| 1254 |
"{\n" |
| 1255 |
" int s, opt;\n" |
| 1256 |
" void *res;\n" |
| 1257 |
" size_t num_threads;\n" |
| 1258 |
" ssize_t stack_size;\n" |
| 1259 |
" pthread_attr_t attr;\n" |
| 1260 |
" struct thread_info *tinfo;\n" |
| 1261 |
"\\&\n" |
| 1262 |
" /* The \"-s\" option specifies a stack size for our threads. */\n" |
| 1263 |
"\\&\n" |
| 1264 |
" stack_size = -1;\n" |
| 1265 |
" while ((opt = getopt(argc, argv, \"s:\")) != -1) {\n" |
| 1266 |
" switch (opt) {\n" |
| 1267 |
" case \\[aq]s\\[aq]:\n" |
| 1268 |
" stack_size = strtoul(optarg, NULL, 0);\n" |
| 1269 |
" break;\n" |
| 1270 |
"\\&\n" |
| 1271 |
" default:\n" |
| 1272 |
" fprintf(stderr, \"Usage: %s [-s stack-size] arg...\\[rs]n\",\n" |
| 1273 |
" argv[0]);\n" |
| 1274 |
" exit(EXIT_FAILURE);\n" |
| 1275 |
" }\n" |
| 1276 |
" }\n" |
| 1277 |
"\\&\n" |
| 1278 |
" num_threads = argc - optind;\n" |
| 1279 |
"\\&\n" |
| 1280 |
" /* Initialize thread creation attributes. */\n" |
| 1281 |
"\\&\n" |
| 1282 |
" s = pthread_attr_init(&attr);\n" |
| 1283 |
" if (s != 0)\n" |
| 1284 |
" handle_error_en(s, \"pthread_attr_init\");\n" |
| 1285 |
"\\&\n" |
| 1286 |
" if (stack_size E<gt> 0) {\n" |
| 1287 |
" s = pthread_attr_setstacksize(&attr, stack_size);\n" |
| 1288 |
" if (s != 0)\n" |
| 1289 |
" handle_error_en(s, \"pthread_attr_setstacksize\");\n" |
| 1290 |
" }\n" |
| 1291 |
"\\&\n" |
| 1292 |
" /* Allocate memory for pthread_create() arguments. */\n" |
| 1293 |
"\\&\n" |
| 1294 |
" tinfo = calloc(num_threads, sizeof(*tinfo));\n" |
| 1295 |
" if (tinfo == NULL)\n" |
| 1296 |
" handle_error(\"calloc\");\n" |
| 1297 |
"\\&\n" |
| 1298 |
" /* Create one thread for each command-line argument. */\n" |
| 1299 |
"\\&\n" |
| 1300 |
" for (size_t tnum = 0; tnum E<lt> num_threads; tnum++) {\n" |
| 1301 |
" tinfo[tnum].thread_num = tnum + 1;\n" |
| 1302 |
" tinfo[tnum].argv_string = argv[optind + tnum];\n" |
| 1303 |
"\\&\n" |
| 1304 |
" /* The pthread_create() call stores the thread ID into\n" |
| 1305 |
" corresponding element of tinfo[]. */\n" |
| 1306 |
"\\&\n" |
| 1307 |
" s = pthread_create(&tinfo[tnum].thread_id, &attr,\n" |
| 1308 |
" &thread_start, &tinfo[tnum]);\n" |
| 1309 |
" if (s != 0)\n" |
| 1310 |
" handle_error_en(s, \"pthread_create\");\n" |
| 1311 |
" }\n" |
| 1312 |
"\\&\n" |
| 1313 |
" /* Destroy the thread attributes object, since it is no\n" |
| 1314 |
" longer needed. */\n" |
| 1315 |
"\\&\n" |
| 1316 |
" s = pthread_attr_destroy(&attr);\n" |
| 1317 |
" if (s != 0)\n" |
| 1318 |
" handle_error_en(s, \"pthread_attr_destroy\");\n" |
| 1319 |
"\\&\n" |
| 1320 |
" /* Now join with each thread, and display its returned value. */\n" |
| 1321 |
"\\&\n" |
| 1322 |
" for (size_t tnum = 0; tnum E<lt> num_threads; tnum++) {\n" |
| 1323 |
" s = pthread_join(tinfo[tnum].thread_id, &res);\n" |
| 1324 |
" if (s != 0)\n" |
| 1325 |
" handle_error_en(s, \"pthread_join\");\n" |
| 1326 |
"\\&\n" |
| 1327 |
" printf(\"Joined with thread %d; returned value was %s\\[rs]n\",\n" |
| 1328 |
" tinfo[tnum].thread_num, (char *) res);\n" |
| 1329 |
" free(res); /* Free memory allocated by thread */\n" |
| 1330 |
" }\n" |
| 1331 |
"\\&\n" |
| 1332 |
" free(tinfo);\n" |
| 1333 |
" exit(EXIT_SUCCESS);\n" |
| 1334 |
"}\n" |
| 1335 |
msgstr "" |
| 1336 |
"#include E<lt>ctype.hE<gt>\n" |
| 1337 |
"#include E<lt>errno.hE<gt>\n" |
| 1338 |
"#include E<lt>pthread.hE<gt>\n" |
| 1339 |
"#include E<lt>stdio.hE<gt>\n" |
| 1340 |
"#include E<lt>stdlib.hE<gt>\n" |
| 1341 |
"#include E<lt>string.hE<gt>\n" |
| 1342 |
"#include E<lt>sys/types.hE<gt>\n" |
| 1343 |
"#include E<lt>unistd.hE<gt>\n" |
| 1344 |
"\\&\n" |
| 1345 |
"#define handle_error_en(en, msg) \\e\n" |
| 1346 |
" do { errno = en; perror(msg); exit(EXIT_FAILURE); } while (0)\n" |
| 1347 |
"\\&\n" |
| 1348 |
"#define handle_error(msg) \\e\n" |
| 1349 |
" do { perror(msg); exit(EXIT_FAILURE); } while (0)\n" |
| 1350 |
"\\&\n" |
| 1351 |
"struct thread_info { /* Utilisé comme argument pour thread_start() */\n" |
| 1352 |
" pthread_t thread_id; /* Identifiant renvoyé par pthread_create() */\n" |
| 1353 |
" int thread_num; /* N° de thread défini par l'application */\n" |
| 1354 |
" char *argv_string; /* À partir de l'argument en ligne de commande */\n" |
| 1355 |
"};\n" |
| 1356 |
"\\&\n" |
| 1357 |
"/* Fonction de démarrage du thread : affiche l'adresse vers le haut de la pile,\n" |
| 1358 |
" et renvoie une copie en majuscule de argv_string. */\n" |
| 1359 |
"\\&\n" |
| 1360 |
"static void *\n" |
| 1361 |
"thread_start(void *arg)\n" |
| 1362 |
"{\n" |
| 1363 |
" struct thread_info *tinfo = arg;\n" |
| 1364 |
" char *uargv;\n" |
| 1365 |
"\\&\n" |
| 1366 |
" printf(\"Thread %d : sommet de la pile près de %p; argv_string=%s\\en\",\n" |
| 1367 |
" tinfo-E<gt>thread_num, (void *) &tinfo, tinfo-E<gt>argv_string);\n" |
| 1368 |
"\\&\n" |
| 1369 |
" uargv = strdup(tinfo-E<gt>argv_string);\n" |
| 1370 |
" if (uargv == NULL)\n" |
| 1371 |
" handle_error(\"strdup\");\n" |
| 1372 |
"\\&\n" |
| 1373 |
" for (char *p = uargv; *p != \\[aq]\\e0\\[aq]; p++)\n" |
| 1374 |
" *p = toupper(*p);\n" |
| 1375 |
"\\&\n" |
| 1376 |
" return uargv;\n" |
| 1377 |
"}\n" |
| 1378 |
"\\&\n" |
| 1379 |
"int\n" |
| 1380 |
"main(int argc, char *argv[])\n" |
| 1381 |
"{\n" |
| 1382 |
" int s, opt;\n" |
| 1383 |
" void *res;\n" |
| 1384 |
" size_t num_threads;\n" |
| 1385 |
" ssize_t stack_size;\n" |
| 1386 |
" pthread_attr_t attr;\n" |
| 1387 |
" struct thread_info *tinfo;\n" |
| 1388 |
"\\&\n" |
| 1389 |
" /* L'option \"-s\" spécifie une taille de pile pour les threads. */\n" |
| 1390 |
"\\&\n" |
| 1391 |
" stack_size = -1;\n" |
| 1392 |
" while ((opt = getopt(argc, argv, \"s:\")) != -1) {\n" |
| 1393 |
" switch (opt) {\n" |
| 1394 |
" case \\[aq]s\\[aq]:\n" |
| 1395 |
" stack_size = strtoul(optarg, NULL, 0);\n" |
| 1396 |
" break;\n" |
| 1397 |
"\\&\n" |
| 1398 |
" default:\n" |
| 1399 |
" fprintf(stderr, \"Usage : %s [-s stack-size] arg...\\en\",\n" |
| 1400 |
" argv[0]);\n" |
| 1401 |
" exit(EXIT_FAILURE);\n" |
| 1402 |
" }\n" |
| 1403 |
" }\n" |
| 1404 |
"\\&\n" |
| 1405 |
" num_threads = argc - optind;\n" |
| 1406 |
"\\&\n" |
| 1407 |
" /* Initialiser les attributs de création de thread. */\n" |
| 1408 |
"\\&\n" |
| 1409 |
" s = pthread_attr_init(&attr);\n" |
| 1410 |
" if (s != 0)\n" |
| 1411 |
" handle_error_en(s, \"pthread_attr_init\");\n" |
| 1412 |
"\\&\n" |
| 1413 |
" if (stack_size E<gt> 0) {\n" |
| 1414 |
" s = pthread_attr_setstacksize(&attr, stack_size);\n" |
| 1415 |
" if (s != 0)\n" |
| 1416 |
" handle_error_en(s, \"pthread_attr_setstacksize\");\n" |
| 1417 |
" }\n" |
| 1418 |
"\\&\n" |
| 1419 |
" /* Allouer la mémoire pour les arguments de pthread_create(). */\n" |
| 1420 |
"\\&\n" |
| 1421 |
" tinfo = calloc(num_threads, sizeof(*tinfo));\n" |
| 1422 |
" if (tinfo == NULL)\n" |
| 1423 |
" handle_error(\"calloc\");\n" |
| 1424 |
"\\&\n" |
| 1425 |
" /* Créer un thread pour chaque argument en ligne de commande. */\n" |
| 1426 |
"\\&\n" |
| 1427 |
" for (size_t tnum = 0; tnum E<lt> num_threads; tnum++) {\n" |
| 1428 |
" tinfo[tnum].thread_num = tnum + 1;\n" |
| 1429 |
" tinfo[tnum].argv_string = argv[optind + tnum];\n" |
| 1430 |
"\\&\n" |
| 1431 |
" /* L'appel pthread_create() stocke l'identifiant du thread dans\n" |
| 1432 |
" l'élément correspondant de tinfo[]. */\n" |
| 1433 |
"\\&\n" |
| 1434 |
" s = pthread_create(&tinfo[tnum].thread_id, &attr,\n" |
| 1435 |
" &thread_start, &tinfo[tnum]);\n" |
| 1436 |
" if (s != 0)\n" |
| 1437 |
" handle_error_en(s, \"pthread_create\");\n" |
| 1438 |
" }\n" |
| 1439 |
"\\&\n" |
| 1440 |
" /* Détruire l'objet des attributs du thread dans la mesure où\n" |
| 1441 |
" il n'est plus nécessaire. */\n" |
| 1442 |
"\\&\n" |
| 1443 |
" s = pthread_attr_destroy(&attr);\n" |
| 1444 |
" if (s != 0)\n" |
| 1445 |
" handle_error_en(s, \"pthread_attr_destroy\");\n" |
| 1446 |
"\\&\n" |
| 1447 |
" /* Maintenant joindre chaque thread et afficher la valeur qu'il renvoie. */\n" |
| 1448 |
"\\&\n" |
| 1449 |
" for (size_t tnum = 0; tnum E<lt> num_threads; tnum++) {\n" |
| 1450 |
" s = pthread_join(tinfo[tnum].thread_id, &res);\n" |
| 1451 |
" if (s != 0)\n" |
| 1452 |
" handle_error_en(s, \"pthread_join\");\n" |
| 1453 |
"\\&\n" |
| 1454 |
" printf(\"Thread joint %d ; la valeur renvoyée est %s\\en\",\n" |
| 1455 |
" tinfo[tnum].thread_num, (char *) res);\n" |
| 1456 |
" free(res); /* Libérer la mémoire allouée par thread */\n" |
| 1457 |
" }\n" |
| 1458 |
"\\&\n" |
| 1459 |
" free(tinfo);\n" |
| 1460 |
" exit(EXIT_SUCCESS);\n" |
| 1461 |
"}\n" |
| 1462 |
|
| 1463 |
#. type: TH |
| 1464 |
#: fedora-44 fedora-rawhide |
| 1465 |
#, no-wrap |
| 1466 |
msgid "2024-12-13" |
| 1467 |
msgstr "13 décembre 2024" |
| 1468 |
|
| 1469 |
#. type: TH |
| 1470 |
#: fedora-44 fedora-rawhide |
| 1471 |
#, no-wrap |
| 1472 |
msgid "Linux man-pages 6.13" |
| 1473 |
msgstr "Pages du manuel de Linux 6.13" |
| 1474 |
|
| 1475 |
#. type: Plain text |
| 1476 |
#: fedora-44 fedora-rawhide |
| 1477 |
#, fuzzy, no-wrap |
| 1478 |
#| msgid "" |
| 1479 |
#| "B<int pthread_create(pthread_t *restrict >I<thread>B<,>\n" |
| 1480 |
#| "B< const pthread_attr_t *restrict >I<attr>B<,>\n" |
| 1481 |
#| "B< void *(*>I<start_routine>B<)(void *),>\n" |
| 1482 |
#| "B< void *restrict >I<arg>B<);>\n" |
| 1483 |
msgid "" |
| 1484 |
"B<int pthread_create(pthread_t *restrict >I<thread>B<,>\n" |
| 1485 |
"B< const pthread_attr_t *restrict >I<attr>B<,>\n" |
| 1486 |
"B< typeof(void *(void *)) *>I<start_routine>B<,>\n" |
| 1487 |
"B< void *restrict >I<arg>B<);>\n" |
| 1488 |
msgstr "" |
| 1489 |
"B<int pthread_create(pthread_t *restrict >I<thread>B<,>\n" |
| 1490 |
"B< const pthread_attr_t *restrict >I<attr>B<,>\n" |
| 1491 |
"B< void *(*>I<start_routine>B<)(void *),>\n" |
| 1492 |
"B< void *restrict >I<arg>B<);>\n" |
| 1493 |
|
| 1494 |
#. type: TH |
| 1495 |
#: mageia-cauldron |
| 1496 |
#, no-wrap |
| 1497 |
msgid "Linux man-pages 6.17" |
| 1498 |
msgstr "Pages du manuel de Linux 6.17" |
| 1499 |
|
| 1500 |
#. type: TH |
| 1501 |
#: opensuse-leap-16-1 opensuse-tumbleweed |
| 1502 |
#, no-wrap |
| 1503 |
msgid "Linux man-pages (unreleased)" |
| 1504 |
msgstr "Pages du manuel de Linux (non publiées)" |