| 1 |
# SOME DESCRIPTIVE TITLE |
| 2 |
# Copyright (C) YEAR Free Software Foundation, Inc. |
| 3 |
# This file is distributed under the same license as the PACKAGE package. |
| 4 |
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR. |
| 5 |
# |
| 6 |
#, fuzzy |
| 7 |
msgid "" |
| 8 |
msgstr "" |
| 9 |
"Project-Id-Version: PACKAGE VERSION\n" |
| 10 |
"POT-Creation-Date: 2026-06-05 06:38+0200\n" |
| 11 |
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" |
| 12 |
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" |
| 13 |
"Language-Team: LANGUAGE <[email protected]>\n" |
| 14 |
"Language: \n" |
| 15 |
"MIME-Version: 1.0\n" |
| 16 |
"Content-Type: text/plain; charset=UTF-8\n" |
| 17 |
"Content-Transfer-Encoding: 8bit\n" |
| 18 |
|
| 19 |
#. type: TH |
| 20 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 21 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 22 |
#, no-wrap |
| 23 |
msgid "pthread_mutexattr_setrobust" |
| 24 |
msgstr "" |
| 25 |
|
| 26 |
#. type: TH |
| 27 |
#: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1 |
| 28 |
#: opensuse-tumbleweed |
| 29 |
#, no-wrap |
| 30 |
msgid "2026-02-08" |
| 31 |
msgstr "" |
| 32 |
|
| 33 |
#. type: TH |
| 34 |
#: archlinux debian-unstable |
| 35 |
#, no-wrap |
| 36 |
msgid "Linux man-pages 6.18" |
| 37 |
msgstr "" |
| 38 |
|
| 39 |
#. type: SH |
| 40 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 41 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 42 |
#, no-wrap |
| 43 |
msgid "NAME" |
| 44 |
msgstr "" |
| 45 |
|
| 46 |
#. type: Plain text |
| 47 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 48 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 49 |
msgid "" |
| 50 |
"pthread_mutexattr_getrobust, pthread_mutexattr_setrobust - get and set the " |
| 51 |
"robustness attribute of a mutex attributes object" |
| 52 |
msgstr "" |
| 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 "LIBRARY" |
| 59 |
msgstr "" |
| 60 |
|
| 61 |
#. type: Plain text |
| 62 |
#: archlinux debian-unstable fedora-44 fedora-rawhide mageia-cauldron |
| 63 |
#: opensuse-leap-16-1 opensuse-tumbleweed |
| 64 |
msgid "POSIX threads library (I<libpthread>,\\ I<-lpthread>)" |
| 65 |
msgstr "" |
| 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 "SYNOPSIS" |
| 72 |
msgstr "" |
| 73 |
|
| 74 |
#. type: Plain text |
| 75 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 76 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 77 |
#, no-wrap |
| 78 |
msgid "B<#include E<lt>pthread.hE<gt>>\n" |
| 79 |
msgstr "" |
| 80 |
|
| 81 |
#. type: Plain text |
| 82 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 83 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 84 |
#, no-wrap |
| 85 |
msgid "" |
| 86 |
"B<int pthread_mutexattr_getrobust(const pthread_mutexattr_t *>I<attr>B<,>\n" |
| 87 |
"B< int *>I<robustness>B<);>\n" |
| 88 |
"B<int pthread_mutexattr_setrobust(pthread_mutexattr_t *>I<attr>B<,>\n" |
| 89 |
"B< int >I<robustness>B<);>\n" |
| 90 |
msgstr "" |
| 91 |
|
| 92 |
#. type: Plain text |
| 93 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 94 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 95 |
msgid "" |
| 96 |
"Feature Test Macro Requirements for glibc (see B<feature_test_macros>(7)):" |
| 97 |
msgstr "" |
| 98 |
|
| 99 |
#. type: Plain text |
| 100 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 101 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 102 |
msgid "B<pthread_mutexattr_getrobust>(), B<pthread_mutexattr_setrobust>():" |
| 103 |
msgstr "" |
| 104 |
|
| 105 |
#. FIXME . |
| 106 |
#. But see https://sourceware.org/bugzilla/show_bug.cgi?id=22125 |
| 107 |
#. type: Plain text |
| 108 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 109 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 110 |
#, no-wrap |
| 111 |
msgid " _POSIX_C_SOURCE E<gt>= 200809L\n" |
| 112 |
msgstr "" |
| 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 "" |
| 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_mutexattr_getrobust>() function places the value of the " |
| 126 |
"robustness attribute of the mutex attributes object referred to by I<attr> " |
| 127 |
"in I<*robustness>. The B<pthread_mutexattr_setrobust>() function sets the " |
| 128 |
"value of the robustness attribute of the mutex attributes object referred to " |
| 129 |
"by I<attr> to the value specified in I<*robustness>." |
| 130 |
msgstr "" |
| 131 |
|
| 132 |
#. type: Plain text |
| 133 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 134 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 135 |
msgid "" |
| 136 |
"The robustness attribute specifies the behavior of the mutex when the owning " |
| 137 |
"thread dies without unlocking the mutex. The following values are valid for " |
| 138 |
"I<robustness>:" |
| 139 |
msgstr "" |
| 140 |
|
| 141 |
#. type: TP |
| 142 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 143 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 144 |
#, no-wrap |
| 145 |
msgid "B<PTHREAD_MUTEX_STALLED>" |
| 146 |
msgstr "" |
| 147 |
|
| 148 |
#. type: Plain text |
| 149 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 150 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 151 |
msgid "" |
| 152 |
"This is the default value for a mutex attributes object. If a mutex is " |
| 153 |
"initialized with the B<PTHREAD_MUTEX_STALLED> attribute and its owner dies " |
| 154 |
"without unlocking it, the mutex remains locked afterwards and any future " |
| 155 |
"attempts to call B<pthread_mutex_lock>(3) on the mutex will block " |
| 156 |
"indefinitely." |
| 157 |
msgstr "" |
| 158 |
|
| 159 |
#. type: TP |
| 160 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 161 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 162 |
#, no-wrap |
| 163 |
msgid "B<PTHREAD_MUTEX_ROBUST>" |
| 164 |
msgstr "" |
| 165 |
|
| 166 |
#. type: Plain text |
| 167 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 168 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 169 |
msgid "" |
| 170 |
"If a mutex is initialized with the B<PTHREAD_MUTEX_ROBUST> attribute and its " |
| 171 |
"owner dies without unlocking it, any future attempts to call " |
| 172 |
"B<pthread_mutex_lock>(3) on this mutex will succeed and return " |
| 173 |
"B<EOWNERDEAD> to indicate that the original owner no longer exists and the " |
| 174 |
"mutex is in an inconsistent state. Usually after B<EOWNERDEAD> is returned, " |
| 175 |
"the next owner should call B<pthread_mutex_consistent>(3) on the acquired " |
| 176 |
"mutex to make it consistent again before using it any further." |
| 177 |
msgstr "" |
| 178 |
|
| 179 |
#. type: Plain text |
| 180 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 181 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 182 |
msgid "" |
| 183 |
"If the next owner unlocks the mutex using B<pthread_mutex_unlock>(3) before " |
| 184 |
"making it consistent, the mutex will be permanently unusable and any " |
| 185 |
"subsequent attempts to lock it using B<pthread_mutex_lock>(3) will fail " |
| 186 |
"with the error B<ENOTRECOVERABLE>. The only permitted operation on such a " |
| 187 |
"mutex is B<pthread_mutex_destroy>(3)." |
| 188 |
msgstr "" |
| 189 |
|
| 190 |
#. type: Plain text |
| 191 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 192 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 193 |
msgid "" |
| 194 |
"If the next owner terminates before calling B<pthread_mutex_consistent>(3), " |
| 195 |
"further B<pthread_mutex_lock>(3) operations on this mutex will still return " |
| 196 |
"B<EOWNERDEAD>." |
| 197 |
msgstr "" |
| 198 |
|
| 199 |
#. type: Plain text |
| 200 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 201 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 202 |
msgid "" |
| 203 |
"Note that the I<attr> argument of B<pthread_mutexattr_getrobust>() and " |
| 204 |
"B<pthread_mutexattr_setrobust>() should refer to a mutex attributes object " |
| 205 |
"that was initialized by B<pthread_mutexattr_init>(3), otherwise the behavior " |
| 206 |
"is undefined." |
| 207 |
msgstr "" |
| 208 |
|
| 209 |
#. type: SH |
| 210 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 211 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 212 |
#, no-wrap |
| 213 |
msgid "RETURN VALUE" |
| 214 |
msgstr "" |
| 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 |
"On success, these functions return 0. On error, they return a positive " |
| 221 |
"error number." |
| 222 |
msgstr "" |
| 223 |
|
| 224 |
#. type: Plain text |
| 225 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 226 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 227 |
msgid "" |
| 228 |
"In the glibc implementation, B<pthread_mutexattr_getrobust>() always return " |
| 229 |
"zero." |
| 230 |
msgstr "" |
| 231 |
|
| 232 |
#. type: SH |
| 233 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 234 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 235 |
#, no-wrap |
| 236 |
msgid "ERRORS" |
| 237 |
msgstr "" |
| 238 |
|
| 239 |
#. type: TP |
| 240 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 241 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 242 |
#, no-wrap |
| 243 |
msgid "B<EINVAL>" |
| 244 |
msgstr "" |
| 245 |
|
| 246 |
#. type: Plain text |
| 247 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 248 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 249 |
msgid "" |
| 250 |
"A value other than B<PTHREAD_MUTEX_STALLED> or B<PTHREAD_MUTEX_ROBUST> was " |
| 251 |
"passed to B<pthread_mutexattr_setrobust>()." |
| 252 |
msgstr "" |
| 253 |
|
| 254 |
#. type: SH |
| 255 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 256 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 257 |
#, no-wrap |
| 258 |
msgid "VERSIONS" |
| 259 |
msgstr "" |
| 260 |
|
| 261 |
#. E.g., Solaris, according to its manual page |
| 262 |
#. type: Plain text |
| 263 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 264 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 265 |
msgid "" |
| 266 |
"In the Linux implementation, when using process-shared robust mutexes, a " |
| 267 |
"waiting thread also receives the B<EOWNERDEAD> notification if the owner of " |
| 268 |
"a robust mutex performs an B<execve>(2) without first unlocking the mutex. " |
| 269 |
"POSIX.1 does not specify this detail, but the same behavior also occurs in " |
| 270 |
"at least some other implementations." |
| 271 |
msgstr "" |
| 272 |
|
| 273 |
#. type: SH |
| 274 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 275 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 276 |
#, no-wrap |
| 277 |
msgid "STANDARDS" |
| 278 |
msgstr "" |
| 279 |
|
| 280 |
#. type: Plain text |
| 281 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 282 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 283 |
msgid "POSIX.1-2008." |
| 284 |
msgstr "" |
| 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 "HISTORY" |
| 291 |
msgstr "" |
| 292 |
|
| 293 |
#. type: Plain text |
| 294 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 295 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 296 |
msgid "glibc 2.12. POSIX.1-2008." |
| 297 |
msgstr "" |
| 298 |
|
| 299 |
#. type: Plain text |
| 300 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 301 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 302 |
msgid "" |
| 303 |
"Before the addition of B<pthread_mutexattr_getrobust>() and " |
| 304 |
"B<pthread_mutexattr_setrobust>() to POSIX, glibc defined the following " |
| 305 |
"equivalent nonstandard functions if B<_GNU_SOURCE> was defined:" |
| 306 |
msgstr "" |
| 307 |
|
| 308 |
#. type: Plain text |
| 309 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 310 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 311 |
#, no-wrap |
| 312 |
msgid "" |
| 313 |
"B<[[deprecated]]>\n" |
| 314 |
"B<int pthread_mutexattr_getrobust_np(const pthread_mutexattr_t *>I<attr>B<,>\n" |
| 315 |
"B< int *>I<robustness>B<);>\n" |
| 316 |
"B<[[deprecated]]>\n" |
| 317 |
"B<int pthread_mutexattr_setrobust_np(const pthread_mutexattr_t *>I<attr>B<,>\n" |
| 318 |
"B< int >I<robustness>B<);>\n" |
| 319 |
msgstr "" |
| 320 |
|
| 321 |
#. type: Plain text |
| 322 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 323 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 324 |
msgid "" |
| 325 |
"Correspondingly, the constants B<PTHREAD_MUTEX_STALLED_NP> and " |
| 326 |
"B<PTHREAD_MUTEX_ROBUST_NP> were also defined." |
| 327 |
msgstr "" |
| 328 |
|
| 329 |
#. type: Plain text |
| 330 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 331 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 332 |
msgid "" |
| 333 |
"These GNU-specific APIs, which first appeared in glibc 2.4, are nowadays " |
| 334 |
"obsolete and should not be used in new programs; since glibc 2.34 these APIs " |
| 335 |
"are marked as deprecated." |
| 336 |
msgstr "" |
| 337 |
|
| 338 |
#. type: SH |
| 339 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 340 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 341 |
#, no-wrap |
| 342 |
msgid "EXAMPLES" |
| 343 |
msgstr "" |
| 344 |
|
| 345 |
#. type: Plain text |
| 346 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 347 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 348 |
msgid "" |
| 349 |
"The program below demonstrates the use of the robustness attribute of a " |
| 350 |
"mutex attributes object. In this program, a thread holding the mutex dies " |
| 351 |
"prematurely without unlocking the mutex. The main thread subsequently " |
| 352 |
"acquires the mutex successfully and gets the error B<EOWNERDEAD>, after " |
| 353 |
"which it makes the mutex consistent." |
| 354 |
msgstr "" |
| 355 |
|
| 356 |
#. type: Plain text |
| 357 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 358 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 359 |
msgid "" |
| 360 |
"The following shell session shows what we see when running this program:" |
| 361 |
msgstr "" |
| 362 |
|
| 363 |
#. type: Plain text |
| 364 |
#: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1 |
| 365 |
#: opensuse-tumbleweed |
| 366 |
#, no-wrap |
| 367 |
msgid "" |
| 368 |
"$B< ./a.out>;\n" |
| 369 |
"[original owner] Setting lock...\n" |
| 370 |
"[original owner] Locked. Now exiting without unlocking.\n" |
| 371 |
"[main] Attempting to lock the robust mutex.\n" |
| 372 |
"[main] pthread_mutex_lock() returned EOWNERDEAD\n" |
| 373 |
"[main] Now make the mutex consistent\n" |
| 374 |
"[main] Mutex is now consistent; unlocking\n" |
| 375 |
msgstr "" |
| 376 |
|
| 377 |
#. type: SS |
| 378 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 379 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 380 |
#, no-wrap |
| 381 |
msgid "Program source" |
| 382 |
msgstr "" |
| 383 |
|
| 384 |
#. type: Plain text |
| 385 |
#: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1 |
| 386 |
#: opensuse-tumbleweed |
| 387 |
#, no-wrap |
| 388 |
msgid "" |
| 389 |
"#include E<lt>err.hE<gt>\n" |
| 390 |
"#include E<lt>errno.hE<gt>\n" |
| 391 |
"#include E<lt>pthread.hE<gt>\n" |
| 392 |
"#include E<lt>stdio.hE<gt>\n" |
| 393 |
"#include E<lt>stdlib.hE<gt>\n" |
| 394 |
"#include E<lt>unistd.hE<gt>\n" |
| 395 |
"\\&\n" |
| 396 |
"static pthread_mutex_t mtx;\n" |
| 397 |
"\\&\n" |
| 398 |
"static void *\n" |
| 399 |
"original_owner_thread(void *ptr)\n" |
| 400 |
"{\n" |
| 401 |
" printf(\"[original owner] Setting lock...\\[rs]n\");\n" |
| 402 |
" pthread_mutex_lock(&mtx);\n" |
| 403 |
" printf(\"[original owner] Locked. Now exiting without unlocking.\\[rs]n\");\n" |
| 404 |
" pthread_exit(NULL);\n" |
| 405 |
"}\n" |
| 406 |
"\\&\n" |
| 407 |
"int\n" |
| 408 |
"main(void)\n" |
| 409 |
"{\n" |
| 410 |
" pthread_t thr;\n" |
| 411 |
" pthread_mutexattr_t attr;\n" |
| 412 |
" int s;\n" |
| 413 |
"\\&\n" |
| 414 |
" pthread_mutexattr_init(&attr);\n" |
| 415 |
"\\&\n" |
| 416 |
" pthread_mutexattr_setrobust(&attr, PTHREAD_MUTEX_ROBUST);\n" |
| 417 |
"\\&\n" |
| 418 |
" pthread_mutex_init(&mtx, &attr);\n" |
| 419 |
"\\&\n" |
| 420 |
" pthread_create(&thr, NULL, original_owner_thread, NULL);\n" |
| 421 |
"\\&\n" |
| 422 |
" sleep(2);\n" |
| 423 |
"\\&\n" |
| 424 |
" /* \"original_owner_thread\" should have exited by now. */\n" |
| 425 |
"\\&\n" |
| 426 |
" printf(\"[main] Attempting to lock the robust mutex.\\[rs]n\");\n" |
| 427 |
" s = pthread_mutex_lock(&mtx);\n" |
| 428 |
" if (s == EOWNERDEAD) {\n" |
| 429 |
" printf(\"[main] pthread_mutex_lock() returned EOWNERDEAD\\[rs]n\");\n" |
| 430 |
" printf(\"[main] Now make the mutex consistent\\[rs]n\");\n" |
| 431 |
" s = pthread_mutex_consistent(&mtx);\n" |
| 432 |
" if (s != 0)\n" |
| 433 |
" errc(EXIT_FAILURE, s, \"pthread_mutex_consistent\");\n" |
| 434 |
" printf(\"[main] Mutex is now consistent; unlocking\\[rs]n\");\n" |
| 435 |
" s = pthread_mutex_unlock(&mtx);\n" |
| 436 |
" if (s != 0)\n" |
| 437 |
" errc(EXIT_FAILURE, s, \"pthread_mutex_unlock\");\n" |
| 438 |
"\\&\n" |
| 439 |
" exit(EXIT_SUCCESS);\n" |
| 440 |
" } else if (s == 0) {\n" |
| 441 |
" printf(\"[main] pthread_mutex_lock() unexpectedly succeeded\\[rs]n\");\n" |
| 442 |
" exit(EXIT_FAILURE);\n" |
| 443 |
" } else {\n" |
| 444 |
" printf(\"[main] pthread_mutex_lock() unexpectedly failed\\[rs]n\");\n" |
| 445 |
" errc(EXIT_FAILURE, s, \"pthread_mutex_lock\");\n" |
| 446 |
" }\n" |
| 447 |
"}\n" |
| 448 |
msgstr "" |
| 449 |
|
| 450 |
#. SRC END |
| 451 |
#. type: SH |
| 452 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 453 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 454 |
#, no-wrap |
| 455 |
msgid "SEE ALSO" |
| 456 |
msgstr "" |
| 457 |
|
| 458 |
#. type: Plain text |
| 459 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 460 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 461 |
msgid "" |
| 462 |
"B<get_robust_list>(2), B<set_robust_list>(2), " |
| 463 |
"B<pthread_mutex_consistent>(3), B<pthread_mutex_init>(3), " |
| 464 |
"B<pthread_mutex_lock>(3), B<pthreads>(7)" |
| 465 |
msgstr "" |
| 466 |
|
| 467 |
#. type: TH |
| 468 |
#: debian-trixie |
| 469 |
#, no-wrap |
| 470 |
msgid "2024-06-15" |
| 471 |
msgstr "" |
| 472 |
|
| 473 |
#. type: TH |
| 474 |
#: debian-trixie |
| 475 |
#, no-wrap |
| 476 |
msgid "Linux man-pages 6.9.1" |
| 477 |
msgstr "" |
| 478 |
|
| 479 |
#. type: Plain text |
| 480 |
#: debian-trixie |
| 481 |
msgid "POSIX threads library (I<libpthread>, I<-lpthread>)" |
| 482 |
msgstr "" |
| 483 |
|
| 484 |
#. type: Plain text |
| 485 |
#: debian-trixie fedora-44 fedora-rawhide |
| 486 |
#, no-wrap |
| 487 |
msgid "" |
| 488 |
"$ B<./a.out>\n" |
| 489 |
"[original owner] Setting lock...\n" |
| 490 |
"[original owner] Locked. Now exiting without unlocking.\n" |
| 491 |
"[main] Attempting to lock the robust mutex.\n" |
| 492 |
"[main] pthread_mutex_lock() returned EOWNERDEAD\n" |
| 493 |
"[main] Now make the mutex consistent\n" |
| 494 |
"[main] Mutex is now consistent; unlocking\n" |
| 495 |
msgstr "" |
| 496 |
|
| 497 |
#. type: Plain text |
| 498 |
#: debian-trixie fedora-44 fedora-rawhide |
| 499 |
#, no-wrap |
| 500 |
msgid "" |
| 501 |
"#include E<lt>errno.hE<gt>\n" |
| 502 |
"#include E<lt>pthread.hE<gt>\n" |
| 503 |
"#include E<lt>stdio.hE<gt>\n" |
| 504 |
"#include E<lt>stdlib.hE<gt>\n" |
| 505 |
"#include E<lt>unistd.hE<gt>\n" |
| 506 |
"\\&\n" |
| 507 |
"#define handle_error_en(en, msg) \\[rs]\n" |
| 508 |
" do { errno = en; perror(msg); exit(EXIT_FAILURE); } while (0)\n" |
| 509 |
"\\&\n" |
| 510 |
"static pthread_mutex_t mtx;\n" |
| 511 |
"\\&\n" |
| 512 |
"static void *\n" |
| 513 |
"original_owner_thread(void *ptr)\n" |
| 514 |
"{\n" |
| 515 |
" printf(\"[original owner] Setting lock...\\[rs]n\");\n" |
| 516 |
" pthread_mutex_lock(&mtx);\n" |
| 517 |
" printf(\"[original owner] Locked. Now exiting without unlocking.\\[rs]n\");\n" |
| 518 |
" pthread_exit(NULL);\n" |
| 519 |
"}\n" |
| 520 |
"\\&\n" |
| 521 |
"int\n" |
| 522 |
"main(void)\n" |
| 523 |
"{\n" |
| 524 |
" pthread_t thr;\n" |
| 525 |
" pthread_mutexattr_t attr;\n" |
| 526 |
" int s;\n" |
| 527 |
"\\&\n" |
| 528 |
" pthread_mutexattr_init(&attr);\n" |
| 529 |
"\\&\n" |
| 530 |
" pthread_mutexattr_setrobust(&attr, PTHREAD_MUTEX_ROBUST);\n" |
| 531 |
"\\&\n" |
| 532 |
" pthread_mutex_init(&mtx, &attr);\n" |
| 533 |
"\\&\n" |
| 534 |
" pthread_create(&thr, NULL, original_owner_thread, NULL);\n" |
| 535 |
"\\&\n" |
| 536 |
" sleep(2);\n" |
| 537 |
"\\&\n" |
| 538 |
" /* \"original_owner_thread\" should have exited by now. */\n" |
| 539 |
"\\&\n" |
| 540 |
" printf(\"[main] Attempting to lock the robust mutex.\\[rs]n\");\n" |
| 541 |
" s = pthread_mutex_lock(&mtx);\n" |
| 542 |
" if (s == EOWNERDEAD) {\n" |
| 543 |
" printf(\"[main] pthread_mutex_lock() returned EOWNERDEAD\\[rs]n\");\n" |
| 544 |
" printf(\"[main] Now make the mutex consistent\\[rs]n\");\n" |
| 545 |
" s = pthread_mutex_consistent(&mtx);\n" |
| 546 |
" if (s != 0)\n" |
| 547 |
" handle_error_en(s, \"pthread_mutex_consistent\");\n" |
| 548 |
" printf(\"[main] Mutex is now consistent; unlocking\\[rs]n\");\n" |
| 549 |
" s = pthread_mutex_unlock(&mtx);\n" |
| 550 |
" if (s != 0)\n" |
| 551 |
" handle_error_en(s, \"pthread_mutex_unlock\");\n" |
| 552 |
"\\&\n" |
| 553 |
" exit(EXIT_SUCCESS);\n" |
| 554 |
" } else if (s == 0) {\n" |
| 555 |
" printf(\"[main] pthread_mutex_lock() unexpectedly succeeded\\[rs]n\");\n" |
| 556 |
" exit(EXIT_FAILURE);\n" |
| 557 |
" } else {\n" |
| 558 |
" printf(\"[main] pthread_mutex_lock() unexpectedly failed\\[rs]n\");\n" |
| 559 |
" handle_error_en(s, \"pthread_mutex_lock\");\n" |
| 560 |
" }\n" |
| 561 |
"}\n" |
| 562 |
msgstr "" |
| 563 |
|
| 564 |
#. type: TH |
| 565 |
#: fedora-44 fedora-rawhide |
| 566 |
#, no-wrap |
| 567 |
msgid "2024-07-23" |
| 568 |
msgstr "" |
| 569 |
|
| 570 |
#. type: TH |
| 571 |
#: fedora-44 fedora-rawhide |
| 572 |
#, no-wrap |
| 573 |
msgid "Linux man-pages 6.13" |
| 574 |
msgstr "" |
| 575 |
|
| 576 |
#. type: TH |
| 577 |
#: mageia-cauldron |
| 578 |
#, no-wrap |
| 579 |
msgid "Linux man-pages 6.17" |
| 580 |
msgstr "" |
| 581 |
|
| 582 |
#. type: TH |
| 583 |
#: opensuse-leap-16-1 opensuse-tumbleweed |
| 584 |
#, no-wrap |
| 585 |
msgid "Linux man-pages (unreleased)" |
| 586 |
msgstr "" |