pthread_rwlock_timedrdlock.html 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156
  1. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
  2. <HTML>
  3. <HEAD>
  4. <META HTTP-EQUIV="CONTENT-TYPE" CONTENT="text/html; charset=utf-8">
  5. <TITLE>&quot;PTHREAD_RWLOCK_TIMEDRDLOCK&quot;(P) manual page</TITLE>
  6. <META NAME="GENERATOR" CONTENT="OpenOffice.org 1.1.3 (Linux)">
  7. <META NAME="CREATED" CONTENT="20050505;11101700">
  8. <META NAME="CHANGED" CONTENT="20050505;12560000">
  9. <!-- manual page source format generated by PolyglotMan v3.2, -->
  10. <!-- available at http://polyglotman.sourceforge.net/ -->
  11. </HEAD>
  12. <BODY LANG="en-GB" BGCOLOR="#ffffff" DIR="LTR">
  13. <H4>POSIX Threads for Windows – REFERENCE - <A HREF="http://sources.redhat.com/pthreads-win32">Pthreads-w32</A></H4>
  14. <P><A HREF="index.html">Reference Index</A></P>
  15. <P><A HREF="#toc">Table of Contents</A></P>
  16. <H2><A HREF="#toc0" NAME="sect0">Name</A></H2>
  17. <P>pthread_rwlock_timedrdlock - lock a read-write lock for reading
  18. </P>
  19. <H2><A HREF="#toc1" NAME="sect1">Synopsis</A></H2>
  20. <P><B>#include &lt;pthread.h&gt; <BR></B>#include &lt;time.h&gt;
  21. </P>
  22. <P><B>int pthread_rwlock_timedrdlock(pthread_rwlock_t *restrict</B>
  23. <I>rwlock</I><B>, const struct timespec *restrict</B> <I>abs_timeout</I><B>);
  24. </B>
  25. </P>
  26. <H2><A HREF="#toc2" NAME="sect2">Description</A></H2>
  27. <P>The <B>pthread_rwlock_timedrdlock</B> function shall apply a read
  28. lock to the read-write lock referenced by <I>rwlock</I> as in the
  29. <A HREF="pthread_rwlock_rdlock.html"><B>pthread_rwlock_rdlock</B>(3)</A>
  30. function. However, if the lock cannot be acquired without waiting for
  31. other threads to unlock the lock, this wait shall be terminated when
  32. the specified timeout expires. The timeout shall expire when the
  33. absolute time specified by <I>abs_timeout</I> passes, as measured by
  34. the clock on which timeouts are based (that is, when the value of
  35. that clock equals or exceeds <I>abs_timeout</I>), or if the absolute
  36. time specified by <I>abs_timeout</I> has already been passed at the
  37. time of the call.
  38. </P>
  39. <P>The <B>timespec</B> data type is defined in the <I>&lt;time.h&gt;</I>
  40. header. Under no circumstances shall the function fail with a timeout
  41. if the lock can be acquired immediately. The validity of the
  42. <I>abs_timeout</I> parameter need not be checked if the lock can be
  43. immediately acquired.
  44. </P>
  45. <P>The calling thread may deadlock if at the time the call is made it
  46. holds a write lock on <I>rwlock</I>. The results are undefined if
  47. this function is called with an uninitialized read-write lock.
  48. </P>
  49. <P><B>Pthreads-w32</B> defines <B>_POSIX_READER_WRITER_LOCKS</B> in
  50. pthread.h as 200112L to indicate that the reader/writer routines are
  51. implemented and may be used.</P>
  52. <H2><A HREF="#toc3" NAME="sect3">Return Value</A></H2>
  53. <P>The <B>pthread_rwlock_timedrdlock</B> function shall return zero
  54. if the lock for reading on the read-write lock object referenced by
  55. <I>rwlock</I> is acquired. Otherwise, an error number shall be
  56. returned to indicate the error.
  57. </P>
  58. <H2><A HREF="#toc4" NAME="sect4">Errors</A></H2>
  59. <P>The <B>pthread_rwlock_timedrdlock</B> function shall fail if:
  60. </P>
  61. <DL>
  62. <DT><B>ETIMEDOUT</B>
  63. </DT><DD STYLE="margin-bottom: 0.5cm">
  64. The lock could not be acquired before the specified timeout expired.
  65. </DD></DL>
  66. <P>
  67. The <B>pthread_rwlock_timedrdlock</B> function may fail if:
  68. </P>
  69. <DL>
  70. <DT><B>EAGAIN</B>
  71. </DT><DD>
  72. The read lock could not be acquired because the maximum number of
  73. read locks for lock would be exceeded.
  74. </DD><DT>
  75. <B>EINVAL</B>
  76. </DT><DD STYLE="margin-bottom: 0.5cm">
  77. The value specified by <I>rwlock</I> does not refer to an
  78. initialized read-write lock object, or the <I>abs_timeout</I>
  79. nanosecond value is less than zero or greater than or equal to 1000
  80. million.
  81. </DD></DL>
  82. <P>
  83. This function shall not return an error code of [EINTR].
  84. </P>
  85. <P><I>The following sections are informative.</I>
  86. </P>
  87. <H2><A HREF="#toc5" NAME="sect5">Examples</A></H2>
  88. <P>None.
  89. </P>
  90. <H2><A HREF="#toc6" NAME="sect6">Application Usage</A></H2>
  91. <P>Applications using this function may be subject to priority
  92. inversion, as discussed in the Base Definitions volume of
  93. IEEE&nbsp;Std&nbsp;1003.1-2001, Section 3.285, Priority Inversion.
  94. </P>
  95. <H2><A HREF="#toc7" NAME="sect7">Rationale</A></H2>
  96. <P>None.
  97. </P>
  98. <H2><A HREF="#toc8" NAME="sect8">Future Directions</A></H2>
  99. <P>None.
  100. </P>
  101. <H2><A HREF="#toc9" NAME="sect9">See Also</A></H2>
  102. <P><A HREF="pthread_rwlock_init.html"><B>pthread_rwlock_destroy</B>(3)</A>
  103. <B>,</B> <A HREF="pthread_rwlock_rdlock.html"><B>pthread_rwlock_rdlock</B>(3)</A>
  104. <B>,</B> <A HREF="pthread_rwlock_timedwrlock.html"><B>pthread_rwlock_timedwrlock</B>(3)</A>
  105. <B>,</B> <A HREF="pthread_rwlock_rdlock.html"><B>pthread_rwlock_tryrdlock</B>(3)</A>
  106. <B>,</B> <A HREF="pthread_rwlock_wrlock.html"><B>pthread_rwlock_trywrlock</B>(3)</A>
  107. <B>,</B> <A HREF="pthread_rwlock_unlock.html"><B>pthread_rwlock_unlock</B>(3)</A>
  108. <B>,</B> <A HREF="pthread_rwlock_wrlock.html"><B>pthread_rwlock_wrlock</B>(3)</A>
  109. <B>,</B> the Base Definitions volume of IEEE&nbsp;Std&nbsp;1003.1-2001,
  110. <I>&lt;pthread.h&gt;</I>, <I>&lt;time.h&gt;</I>
  111. </P>
  112. <H2><A HREF="#toc10" NAME="sect10">Copyright</A></H2>
  113. <P>Portions of this text are reprinted and reproduced in electronic
  114. form from IEEE Std 1003.1, 2003 Edition, Standard for Information
  115. Technology -- Portable Operating System Interface (POSIX), The Open
  116. Group Base Specifications Issue 6, Copyright (C) 2001-2003 by the
  117. Institute of Electrical and Electronics Engineers, Inc and The Open
  118. Group. In the event of any discrepancy between this version and the
  119. original IEEE and The Open Group Standard, the original IEEE and The
  120. Open Group Standard is the referee document. The original Standard
  121. can be obtained online at <A HREF="http://www.opengroup.org/unix/online.html">http://www.opengroup.org/unix/online.html</A>
  122. .
  123. </P>
  124. <P>Modified by Ross Johnson for use with <A HREF="http://sources.redhat.com/pthreads-win32">Pthreads-w32</A>.</P>
  125. <HR>
  126. <P><A NAME="toc"></A><B>Table of Contents</B></P>
  127. <UL>
  128. <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect0" NAME="toc0">Name</A>
  129. </P>
  130. <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect1" NAME="toc1">Synopsis</A>
  131. </P>
  132. <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect2" NAME="toc2">Description</A>
  133. </P>
  134. <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect3" NAME="toc3">Return
  135. Value</A>
  136. </P>
  137. <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect4" NAME="toc4">Errors</A>
  138. </P>
  139. <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect5" NAME="toc5">Examples</A>
  140. </P>
  141. <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect6" NAME="toc6">Application
  142. Usage</A>
  143. </P>
  144. <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect7" NAME="toc7">Rationale</A>
  145. </P>
  146. <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect8" NAME="toc8">Future
  147. Directions</A>
  148. </P>
  149. <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect9" NAME="toc9">See
  150. Also</A>
  151. </P>
  152. <LI><P><A HREF="#sect10" NAME="toc10">Copyright</A>
  153. </P>
  154. </UL>
  155. </BODY>
  156. </HTML>