summaryrefslogtreecommitdiff
path: root/static/freebsd/man3/pthread_mutex_timedlock.3 3.html
blob: 8bc586422b0fca6c256b88579dff0ab48bb18f04 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
<table class="head">
  <tr>
    <td class="head-ltitle">PTHREAD_MUTEX_TIMEDLOCK(3)</td>
    <td class="head-vol">Library Functions Manual</td>
    <td class="head-rtitle">PTHREAD_MUTEX_TIMEDLOCK(3)</td>
  </tr>
</table>
<div class="manual-text">
<section class="Sh">
<h1 class="Sh" id="NAME"><a class="permalink" href="#NAME">NAME</a></h1>
<p class="Pp"><code class="Nm">pthread_mutex_timedlock</code> &#x2014;
    <span class="Nd">lock a mutex without blocking indefinitely</span></p>
</section>
<section class="Sh">
<h1 class="Sh" id="LIBRARY"><a class="permalink" href="#LIBRARY">LIBRARY</a></h1>
<p class="Pp"><span class="Lb">POSIX Threads Library (libpthread,
    -lpthread)</span></p>
</section>
<section class="Sh">
<h1 class="Sh" id="SYNOPSIS"><a class="permalink" href="#SYNOPSIS">SYNOPSIS</a></h1>
<p class="Pp"><code class="In">#include
    &lt;<a class="In">pthread.h</a>&gt;</code>
  <br/>
  <code class="In">#include &lt;<a class="In">time.h</a>&gt;</code></p>
<p class="Pp"><var class="Ft">int</var>
  <br/>
  <code class="Fn">pthread_mutex_timedlock</code>(<var class="Fa" style="white-space: nowrap;">pthread_mutex_t
    *restrict mutex</var>, <var class="Fa" style="white-space: nowrap;">const
    struct timespec *restrict abs_timeout</var>);</p>
</section>
<section class="Sh">
<h1 class="Sh" id="DESCRIPTION"><a class="permalink" href="#DESCRIPTION">DESCRIPTION</a></h1>
<p class="Pp">The
    <a class="permalink" href="#pthread_mutex_timedlock"><code class="Fn" id="pthread_mutex_timedlock">pthread_mutex_timedlock</code></a>()
    function will lock <var class="Fa">mutex</var>. If it is already locked the
    calling thread will block until the mutex becomes available or the timeout,
    specified by abs_timeout, expires. The time of the timeout is an absolute
    time and is not relative to the current time.</p>
</section>
<section class="Sh">
<h1 class="Sh" id="RETURN_VALUES"><a class="permalink" href="#RETURN_VALUES">RETURN
  VALUES</a></h1>
<p class="Pp">If successful, <code class="Fn">pthread_mutex_timedlock</code>()
    will return zero, otherwise an error number will be returned to indicate the
    error.</p>
</section>
<section class="Sh">
<h1 class="Sh" id="ERRORS"><a class="permalink" href="#ERRORS">ERRORS</a></h1>
<p class="Pp">The <code class="Fn">pthread_mutex_timedlock</code>() function
    will fail if:</p>
<dl class="Bl-tag">
  <dt>[Er ENOTRECOVERABLE]</dt>
  <dd>The <var class="Fa">mutex</var> was created with the protocol attribute
      having the value PTHREAD_PRIO_PROTECT and the calling thread's priority is
      higher than the mutex's current priority ceiling.</dd>
  <dt id="EINVAL">[<a class="permalink" href="#EINVAL"><code class="Er">EINVAL</code></a>]</dt>
  <dd>The process or thread would have blocked, and
      <var class="Fa">abs_timeout</var> specified a nanosecond value less than
      zero or greater than or equal to 1 billion.</dd>
  <dt id="EINVAL~2">[<a class="permalink" href="#EINVAL~2"><code class="Er">EINVAL</code></a>]</dt>
  <dd>The <var class="Fa">mutex</var> parameter is invalid.</dd>
  <dt id="ETIMEDOUT">[<a class="permalink" href="#ETIMEDOUT"><code class="Er">ETIMEDOUT</code></a>]</dt>
  <dd>The <var class="Fa">mutex</var> could not be locked before the timeout
      expired.</dd>
  <dt id="EAGAIN">[<a class="permalink" href="#EAGAIN"><code class="Er">EAGAIN</code></a>]</dt>
  <dd>The <var class="Fa">mutex</var> could not be acquired because the maximum
      number of recursive locks for the <var class="Fa">mutex</var> has been
      exceeded.</dd>
  <dt id="EDEADLK">[<a class="permalink" href="#EDEADLK"><code class="Er">EDEADLK</code></a>]</dt>
  <dd>The current thread already owns the <var class="Fa">mutex</var>.</dd>
  <dt id="EOWNERDEAD">[<a class="permalink" href="#EOWNERDEAD"><code class="Er">EOWNERDEAD</code></a>]</dt>
  <dd>The argument <var class="Fa">mutex</var> points to a robust mutex and the
      process containing the previous owning thread terminated while holding the
      mutex lock. The lock was granted to the caller and it is up to the new
      owner to make the state consistent.</dd>
  <dt id="ENOTRECOVERABLE">[<a class="permalink" href="#ENOTRECOVERABLE"><code class="Er">ENOTRECOVERABLE</code></a>]</dt>
  <dd>The state protected by the <var class="Fa">mutex</var> is not
    recoverable.</dd>
</dl>
</section>
<section class="Sh">
<h1 class="Sh" id="SEE_ALSO"><a class="permalink" href="#SEE_ALSO">SEE
  ALSO</a></h1>
<p class="Pp"><a class="Xr">pthread_mutex_consistent(3)</a>,
    <a class="Xr">pthread_mutex_destroy(3)</a>,
    <a class="Xr">pthread_mutex_init(3)</a>,
    <a class="Xr">pthread_mutex_lock(3)</a>,
    <a class="Xr">pthread_mutex_trylock(3)</a>,
    <a class="Xr">pthread_mutex_unlock(3)</a></p>
</section>
<section class="Sh">
<h1 class="Sh" id="STANDARDS"><a class="permalink" href="#STANDARDS">STANDARDS</a></h1>
<p class="Pp">The <code class="Fn">pthread_mutex_timedlock</code>() function is
    expected to conform to <span class="St">ISO/IEC 9945-1:1996
    (&#x201C;POSIX.1&#x201D;)</span>.</p>
</section>
</div>
<table class="foot">
  <tr>
    <td class="foot-date">August 7, 2019</td>
    <td class="foot-os">FreeBSD 15.0</td>
  </tr>
</table>