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_spin_lock.3p (3713B)


  1. '\" et
  2. .TH PTHREAD_SPIN_LOCK "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_spin_lock,
  12. pthread_spin_trylock
  13. \(em lock a spin lock object
  14. .SH SYNOPSIS
  15. .LP
  16. .nf
  17. #include <pthread.h>
  18. .P
  19. int pthread_spin_lock(pthread_spinlock_t *\fIlock\fP);
  20. int pthread_spin_trylock(pthread_spinlock_t *\fIlock\fP);
  21. .fi
  22. .SH DESCRIPTION
  23. The
  24. \fIpthread_spin_lock\fR()
  25. function shall lock the spin lock referenced by
  26. .IR lock .
  27. The calling thread shall acquire the lock if it is not held by another
  28. thread. Otherwise, the thread shall spin (that is, shall not return
  29. from the
  30. \fIpthread_spin_lock\fR()
  31. call) until the lock becomes available. The results are undefined if
  32. the calling thread holds the lock at the time the call is made. The
  33. \fIpthread_spin_trylock\fR()
  34. function shall lock the spin lock referenced by
  35. .IR lock
  36. if it is not held by any thread. Otherwise, the function shall fail.
  37. .P
  38. The results are undefined if any of these functions is called with an
  39. uninitialized spin lock.
  40. .SH "RETURN VALUE"
  41. Upon successful completion, these functions shall return zero;
  42. otherwise, an error number shall be returned to indicate the error.
  43. .SH ERRORS
  44. The
  45. \fIpthread_spin_lock\fR()
  46. function may fail if:
  47. .TP
  48. .BR EDEADLK
  49. A deadlock condition was detected.
  50. .P
  51. The
  52. \fIpthread_spin_trylock\fR()
  53. function shall fail if:
  54. .TP
  55. .BR EBUSY
  56. A thread currently holds the lock.
  57. .P
  58. These functions shall not return an error code of
  59. .BR [EINTR] .
  60. .LP
  61. .IR "The following sections are informative."
  62. .SH EXAMPLES
  63. None.
  64. .SH "APPLICATION USAGE"
  65. Applications using this function may be subject to priority inversion,
  66. as discussed in the Base Definitions volume of POSIX.1\(hy2017,
  67. .IR "Section 3.291" ", " "Priority Inversion".
  68. .SH RATIONALE
  69. If an implementation detects that the value specified by the
  70. .IR lock
  71. argument to
  72. \fIpthread_spin_lock\fR()
  73. or
  74. \fIpthread_spin_trylock\fR()
  75. does not refer to an initialized spin lock object, it is recommended
  76. that the function should fail and report an
  77. .BR [EINVAL]
  78. error.
  79. .P
  80. If an implementation detects that the value specified by the
  81. .IR lock
  82. argument to
  83. \fIpthread_spin_lock\fR()
  84. refers to a spin lock object for which the calling thread already
  85. holds the lock, it is recommended that the function should fail
  86. and report an
  87. .BR [EDEADLK]
  88. error.
  89. .SH "FUTURE DIRECTIONS"
  90. None.
  91. .SH "SEE ALSO"
  92. .IR "\fIpthread_spin_destroy\fR\^(\|)",
  93. .IR "\fIpthread_spin_unlock\fR\^(\|)"
  94. .P
  95. The Base Definitions volume of POSIX.1\(hy2017,
  96. .IR "Section 3.291" ", " "Priority Inversion",
  97. .IR "Section 4.12" ", " "Memory Synchronization",
  98. .IR "\fB<pthread.h>\fP"
  99. .\"
  100. .SH COPYRIGHT
  101. Portions of this text are reprinted and reproduced in electronic form
  102. from IEEE Std 1003.1-2017, Standard for Information Technology
  103. -- Portable Operating System Interface (POSIX), The Open Group Base
  104. Specifications Issue 7, 2018 Edition,
  105. Copyright (C) 2018 by the Institute of
  106. Electrical and Electronics Engineers, Inc and The Open Group.
  107. In the event of any discrepancy between this version and the original IEEE and
  108. The Open Group Standard, the original IEEE and The Open Group Standard
  109. is the referee document. The original Standard can be obtained online at
  110. http://www.opengroup.org/unix/online.html .
  111. .PP
  112. Any typographical or formatting errors that appear
  113. in this page are most likely
  114. to have been introduced during the conversion of the source files to
  115. man page format. To report such errors, see
  116. https://www.kernel.org/doc/man-pages/reporting_bugs.html .