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_destroy.3p (4592B)


  1. '\" et
  2. .TH PTHREAD_SPIN_DESTROY "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_destroy,
  12. pthread_spin_init
  13. \(em destroy or initialize a spin lock object
  14. .SH SYNOPSIS
  15. .LP
  16. .nf
  17. #include <pthread.h>
  18. .P
  19. int pthread_spin_destroy(pthread_spinlock_t *\fIlock\fP);
  20. int pthread_spin_init(pthread_spinlock_t *\fIlock\fP, int \fIpshared\fP);
  21. .fi
  22. .SH DESCRIPTION
  23. The
  24. \fIpthread_spin_destroy\fR()
  25. function shall destroy the spin lock referenced by
  26. .IR lock
  27. and release any resources used by the lock. The effect of subsequent
  28. use of the lock is undefined until the lock is reinitialized by another
  29. call to
  30. \fIpthread_spin_init\fR().
  31. The results are undefined if
  32. \fIpthread_spin_destroy\fR()
  33. is called when a thread holds the lock, or if this function is called
  34. with an uninitialized thread spin lock.
  35. .P
  36. The
  37. \fIpthread_spin_init\fR()
  38. function shall allocate any resources required to use the spin lock
  39. referenced by
  40. .IR lock
  41. and initialize the lock to an unlocked state.
  42. .P
  43. If the Thread Process-Shared Synchronization option is supported and
  44. the value of
  45. .IR pshared
  46. is PTHREAD_PROCESS_SHARED, the implementation
  47. shall permit the spin lock to be operated upon by any thread that has
  48. access to the memory where the spin lock is allocated, even if it is
  49. allocated in memory that is shared by multiple processes.
  50. .P
  51. See
  52. .IR "Section 2.9.9" ", " "Synchronization Object Copies and Alternative Mappings"
  53. for further requirements.
  54. .P
  55. The results are undefined if
  56. \fIpthread_spin_init\fR()
  57. is called specifying an already initialized spin lock. The results are
  58. undefined if a spin lock is used without first being initialized.
  59. .P
  60. If the
  61. \fIpthread_spin_init\fR()
  62. function fails, the lock is not initialized and the contents of
  63. .IR lock
  64. are undefined.
  65. .P
  66. Only the object referenced by
  67. .IR lock
  68. may be used for performing synchronization.
  69. .P
  70. The result of referring to copies of that object in calls to
  71. \fIpthread_spin_destroy\fR(),
  72. \fIpthread_spin_lock\fR(),
  73. \fIpthread_spin_trylock\fR(),
  74. or
  75. \fIpthread_spin_unlock\fR()
  76. is undefined.
  77. .SH "RETURN VALUE"
  78. Upon successful completion, these functions shall return zero;
  79. otherwise, an error number shall be returned to indicate the error.
  80. .SH ERRORS
  81. The
  82. \fIpthread_spin_init\fR()
  83. function shall fail if:
  84. .TP
  85. .BR EAGAIN
  86. The system lacks the necessary resources to initialize another spin
  87. lock.
  88. .TP
  89. .BR ENOMEM
  90. Insufficient memory exists to initialize the lock.
  91. .P
  92. These functions shall not return an error code of
  93. .BR [EINTR] .
  94. .LP
  95. .IR "The following sections are informative."
  96. .SH EXAMPLES
  97. None.
  98. .SH "APPLICATION USAGE"
  99. None.
  100. .SH RATIONALE
  101. If an implementation detects that the value specified by the
  102. .IR lock
  103. argument to
  104. \fIpthread_spin_destroy\fR()
  105. does not refer to an initialized spin lock object, it is recommended
  106. that the function should fail and report an
  107. .BR [EINVAL]
  108. error.
  109. .P
  110. If an implementation detects that the value specified by the
  111. .IR lock
  112. argument to
  113. \fIpthread_spin_destroy\fR()
  114. or
  115. \fIpthread_spin_init\fR()
  116. refers to a locked spin lock object, or detects that the value specified
  117. by the
  118. .IR lock
  119. argument to
  120. \fIpthread_spin_init\fR()
  121. refers to an already initialized spin lock object, it is recommended
  122. that the function should fail and report an
  123. .BR [EBUSY]
  124. error.
  125. .SH "FUTURE DIRECTIONS"
  126. None.
  127. .SH "SEE ALSO"
  128. .ad l
  129. .IR "\fIpthread_spin_lock\fR\^(\|)",
  130. .IR "\fIpthread_spin_unlock\fR\^(\|)"
  131. .ad b
  132. .P
  133. The Base Definitions volume of POSIX.1\(hy2017,
  134. .IR "\fB<pthread.h>\fP"
  135. .\"
  136. .SH COPYRIGHT
  137. Portions of this text are reprinted and reproduced in electronic form
  138. from IEEE Std 1003.1-2017, Standard for Information Technology
  139. -- Portable Operating System Interface (POSIX), The Open Group Base
  140. Specifications Issue 7, 2018 Edition,
  141. Copyright (C) 2018 by the Institute of
  142. Electrical and Electronics Engineers, Inc and The Open Group.
  143. In the event of any discrepancy between this version and the original IEEE and
  144. The Open Group Standard, the original IEEE and The Open Group Standard
  145. is the referee document. The original Standard can be obtained online at
  146. http://www.opengroup.org/unix/online.html .
  147. .PP
  148. Any typographical or formatting errors that appear
  149. in this page are most likely
  150. to have been introduced during the conversion of the source files to
  151. man page format. To report such errors, see
  152. https://www.kernel.org/doc/man-pages/reporting_bugs.html .