logo

oasis-root

Compiled tree of Oasis Linux based on own branch at <https://hacktivis.me/git/oasis/> git clone https://anongit.hacktivis.me/git/oasis-root.git

pthread_rwlock_trywrlock.3p (4476B)


  1. '\" et
  2. .TH PTHREAD_RWLOCK_TRYWRLOCK "3P" 2017 "IEEE/The Open Group" "POSIX Programmer's Manual"
  3. .\"
  4. .SH PROLOG
  5. This manual page is part of the POSIX Programmer's Manual.
  6. The Linux implementation of this interface may differ (consult
  7. the corresponding Linux manual page for details of Linux behavior),
  8. or the interface may not be implemented on Linux.
  9. .\"
  10. .SH NAME
  11. pthread_rwlock_trywrlock,
  12. pthread_rwlock_wrlock
  13. \(em lock a read-write lock object for writing
  14. .SH SYNOPSIS
  15. .LP
  16. .nf
  17. #include <pthread.h>
  18. .P
  19. int pthread_rwlock_trywrlock(pthread_rwlock_t *\fIrwlock\fP);
  20. int pthread_rwlock_wrlock(pthread_rwlock_t *\fIrwlock\fP);
  21. .fi
  22. .SH DESCRIPTION
  23. The
  24. \fIpthread_rwlock_trywrlock\fR()
  25. function shall apply a write lock like the
  26. \fIpthread_rwlock_wrlock\fR()
  27. function, with the exception that the function shall fail if any thread
  28. currently holds
  29. .IR rwlock
  30. (for reading or writing).
  31. .P
  32. The
  33. \fIpthread_rwlock_wrlock\fR()
  34. function shall apply a write lock to the read-write lock referenced by
  35. .IR rwlock .
  36. The calling thread shall acquire the write lock if no thread (reader
  37. or writer) holds the read-write lock
  38. .IR rwlock .
  39. Otherwise, if another thread holds the read-write lock
  40. .IR rwlock ,
  41. the calling thread shall block until it can acquire the lock.
  42. If a deadlock condition occurs or the calling thread already owns the
  43. read-write lock for writing or reading, the call shall either deadlock
  44. or return
  45. .BR [EDEADLK] .
  46. .P
  47. Results are undefined if any of these functions are called with an
  48. uninitialized read-write lock.
  49. .P
  50. If a signal is delivered to a thread waiting for a read-write lock for
  51. writing, upon return from the signal handler the thread resumes waiting
  52. for the read-write lock for writing as if it was not interrupted.
  53. .SH "RETURN VALUE"
  54. The
  55. \fIpthread_rwlock_trywrlock\fR()
  56. function shall return zero if the lock for writing on the read-write
  57. lock object referenced by
  58. .IR rwlock
  59. is acquired. Otherwise, an error number shall be returned to indicate
  60. the error.
  61. .P
  62. If successful, the
  63. \fIpthread_rwlock_wrlock\fR()
  64. function shall return zero; otherwise, an error number shall be
  65. returned to indicate the error.
  66. .SH ERRORS
  67. The
  68. \fIpthread_rwlock_trywrlock\fR()
  69. function shall fail if:
  70. .TP
  71. .BR EBUSY
  72. The read-write lock could not be acquired for writing because it was
  73. already locked for reading or writing.
  74. .P
  75. The
  76. \fIpthread_rwlock_wrlock\fR()
  77. function may fail if:
  78. .TP
  79. .BR EDEADLK
  80. A deadlock condition was detected or the current thread already owns
  81. the read-write lock for writing or reading.
  82. .P
  83. These functions shall not return an error code of
  84. .BR [EINTR] .
  85. .LP
  86. .IR "The following sections are informative."
  87. .SH EXAMPLES
  88. None.
  89. .SH "APPLICATION USAGE"
  90. Applications using these functions may be subject to priority inversion,
  91. as discussed in the Base Definitions volume of POSIX.1\(hy2017,
  92. .IR "Section 3.291" ", " "Priority Inversion".
  93. .SH RATIONALE
  94. If an implementation detects that the value specified by the
  95. .IR rwlock
  96. argument to
  97. \fIpthread_rwlock_trywrlock\fR()
  98. or
  99. \fIpthread_rwlock_wrlock\fR()
  100. does not refer to an initialized read-write lock object, it is
  101. recommended that the function should fail and report an
  102. .BR [EINVAL]
  103. error.
  104. .SH "FUTURE DIRECTIONS"
  105. None.
  106. .SH "SEE ALSO"
  107. .ad l
  108. .IR "\fIpthread_rwlock_destroy\fR\^(\|)",
  109. .IR "\fIpthread_rwlock_rdlock\fR\^(\|)",
  110. .IR "\fIpthread_rwlock_timedrdlock\fR\^(\|)",
  111. .IR "\fIpthread_rwlock_timedwrlock\fR\^(\|)",
  112. .IR "\fIpthread_rwlock_unlock\fR\^(\|)"
  113. .ad b
  114. .P
  115. The Base Definitions volume of POSIX.1\(hy2017,
  116. .IR "Section 3.291" ", " "Priority Inversion",
  117. .IR "Section 4.12" ", " "Memory Synchronization",
  118. .IR "\fB<pthread.h>\fP"
  119. .\"
  120. .SH COPYRIGHT
  121. Portions of this text are reprinted and reproduced in electronic form
  122. from IEEE Std 1003.1-2017, Standard for Information Technology
  123. -- Portable Operating System Interface (POSIX), The Open Group Base
  124. Specifications Issue 7, 2018 Edition,
  125. Copyright (C) 2018 by the Institute of
  126. Electrical and Electronics Engineers, Inc and The Open Group.
  127. In the event of any discrepancy between this version and the original IEEE and
  128. The Open Group Standard, the original IEEE and The Open Group Standard
  129. is the referee document. The original Standard can be obtained online at
  130. http://www.opengroup.org/unix/online.html .
  131. .PP
  132. Any typographical or formatting errors that appear
  133. in this page are most likely
  134. to have been introduced during the conversion of the source files to
  135. man page format. To report such errors, see
  136. https://www.kernel.org/doc/man-pages/reporting_bugs.html .