pthread_rwlock_timedwrlock.html 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  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_TIMEDWRLOCK&quot;(P) manual page</TITLE>
  6. <META NAME="GENERATOR" CONTENT="OpenOffice.org 1.1.3 (Linux)">
  7. <META NAME="CREATED" CONTENT="20050505;11172800">
  8. <META NAME="CHANGED" CONTENT="20050505;12561600">
  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_timedwrlock - lock a read-write lock for writing
  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_timedwrlock(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_timedwrlock</B> function shall apply a write
  28. lock to the read-write lock referenced by <I>rwlock</I> as in the
  29. <A HREF="pthread_rwlock_wrlock.html"><B>pthread_rwlock_wrlock</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 the read-write lock. The results are undefined if this function
  47. 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_timedwrlock</B> function shall return zero
  54. if the lock for writing 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_timedwrlock</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_timedwrlock</B> function may fail if:
  68. </P>
  69. <DL>
  70. <DT><B>EINVAL</B>
  71. </DT><DD STYLE="margin-bottom: 0.5cm">
  72. The value specified by rwlock does not refer to an initialized
  73. read-write lock object, or the <I>abs_timeout</I> nanosecond value
  74. is less than zero or greater than or equal to 1000 million.
  75. </DD></DL>
  76. <P>
  77. This function shall not return an error code of [EINTR].
  78. </P>
  79. <P><I>The following sections are informative.</I>
  80. </P>
  81. <H2><A HREF="#toc5" NAME="sect5">Examples</A></H2>
  82. <P>None.
  83. </P>
  84. <H2><A HREF="#toc6" NAME="sect6">Application Usage</A></H2>
  85. <P>Applications using this function may be subject to priority
  86. inversion, as discussed in the Base Definitions volume of
  87. IEEE&nbsp;Std&nbsp;1003.1-2001, Section 3.285, Priority Inversion.
  88. </P>
  89. <H2><A HREF="#toc7" NAME="sect7">Rationale</A></H2>
  90. <P>None.
  91. </P>
  92. <H2><A HREF="#toc8" NAME="sect8">Future Directions</A></H2>
  93. <P>None.
  94. </P>
  95. <H2><A HREF="#toc9" NAME="sect9">See Also</A></H2>
  96. <P><A HREF="pthread_rwlock_init.html"><B>pthread_rwlock_destroy</B>(3)</A>
  97. <B>,</B> <A HREF="pthread_rwlock_rdlock.html"><B>pthread_rwlock_rdlock</B>(3)</A>
  98. <B>,</B> <A HREF="pthread_rwlock_timedrdlock.html"><B>pthread_rwlock_timedrdlock</B>(3)</A>
  99. <B>,</B> <A HREF="pthread_rwlock_rdlock.html"><B>pthread_rwlock_tryrdlock</B>(3)</A>
  100. <B>,</B> <A HREF="pthread_rwlock_wrlock.html"><B>pthread_rwlock_trywrlock</B>(3)</A>
  101. <B>,</B> <A HREF="pthread_rwlock_unlock.html"><B>pthread_rwlock_unlock</B>(3)</A>
  102. <B>,</B> <A HREF="pthread_rwlock_wrlock.html"><B>pthread_rwlock_wrlock</B>(3)</A>
  103. <B>,</B> the Base Definitions volume of IEEE&nbsp;Std&nbsp;1003.1-2001,
  104. <I>&lt;pthread.h&gt;</I>, <I>&lt;time.h&gt;</I>
  105. </P>
  106. <H2><A HREF="#toc10" NAME="sect10">Copyright</A></H2>
  107. <P>Portions of this text are reprinted and reproduced in electronic
  108. form from IEEE Std 1003.1, 2003 Edition, Standard for Information
  109. Technology -- Portable Operating System Interface (POSIX), The Open
  110. Group Base Specifications Issue 6, Copyright (C) 2001-2003 by the
  111. Institute of Electrical and Electronics Engineers, Inc and The Open
  112. Group. In the event of any discrepancy between this version and the
  113. original IEEE and The Open Group Standard, the original IEEE and The
  114. Open Group Standard is the referee document. The original Standard
  115. can be obtained online at <A HREF="http://www.opengroup.org/unix/online.html">http://www.opengroup.org/unix/online.html</A>
  116. .
  117. </P>
  118. <P>Modified by Ross Johnson for use with <A HREF="http://sources.redhat.com/pthreads-win32">Pthreads-w32</A>.</P>
  119. <HR>
  120. <P><A NAME="toc"></A><B>Table of Contents</B></P>
  121. <UL>
  122. <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect0" NAME="toc0">Name</A>
  123. </P>
  124. <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect1" NAME="toc1">Synopsis</A>
  125. </P>
  126. <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect2" NAME="toc2">Description</A>
  127. </P>
  128. <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect3" NAME="toc3">Return
  129. Value</A>
  130. </P>
  131. <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect4" NAME="toc4">Errors</A>
  132. </P>
  133. <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect5" NAME="toc5">Examples</A>
  134. </P>
  135. <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect6" NAME="toc6">Application
  136. Usage</A>
  137. </P>
  138. <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect7" NAME="toc7">Rationale</A>
  139. </P>
  140. <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect8" NAME="toc8">Future
  141. Directions</A>
  142. </P>
  143. <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect9" NAME="toc9">See
  144. Also</A>
  145. </P>
  146. <LI><P><A HREF="#sect10" NAME="toc10">Copyright</A>
  147. </P>
  148. </UL>
  149. </BODY>
  150. </HTML>