Files
hustoj/web/cppreference-zh/chmhelp/c-thread-mtx_timedlock.html
2025-08-01 12:57:54 +08:00

112 lines
5.8 KiB
HTML

<!DOCTYPE html>
<html lang="zh" dir="ltr" class="client-nojs" xmlns="http://www.w3.org/1999/xhtml" xml:lang="zh">
<head><meta http-equiv="x-ua-compatible" content="ie=edge">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>mtx_timedlock</title>
<link rel="stylesheet" href="ext.css" />
<link rel="stylesheet" href="site_modules.css" />
</head>
<body class="mediawiki ltr sitedir-ltr ns-0 ns-subject page-c_thread_mtx_timedlock skin-cppreference2 action-view cpp-navbar">
<div id="cpp-content-base">
<div id="content"><a id="top"></a>
<h1 id="firstHeading" class="firstHeading">mtx_timedlock</h1>
<div id="bodyContent">
<div id="contentSub"><span class="subpages">&lt; <a href="c.html">c</a>&lrm; | <a href="c-thread.html">thread</a></span></div>
<div id="mw-content-text" lang="zh" dir="ltr" class="mw-content-ltr" xml:lang="zh">
<table class="t-dcl-begin">
<tbody>
<tr class="t-dsc-header">
<td>
<div>&#23450;&#20041;&#20110;&#22836;&#25991;&#20214; <code>&lt;threads.h&gt;</code></div>
</td>
<td></td>
<td></td>
</tr>
<tr class="t-dcl t-since-c11">
<td>
<div><span class="mw-geshi c source-c"><span class="kw4">int</span> mtx_timedlock<span class="br0">(</span> <a href="c-thread.html"><span class="kw1011">mtx_t</span></a> <span class="sy2">*</span><span class="kw4">restrict</span> mutex,<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="kw4">const</span> <span class="kw1">struct</span> timespec <span class="sy2">*</span><span class="kw4">restrict</span> time_point <span class="br0">)</span><span class="sy4">;</span></span></div>
</td>
<td class="t-dcl-nopad"></td>
<td><span class="t-mark-rev t-since-c11">(C11 &#36215;)</span></td>
</tr>
<tr class="t-dcl-sep">
<td></td>
<td></td>
<td></td>
</tr>
</tbody>
</table>
<p>&#38459;&#22622;&#24403;&#21069;&#32447;&#31243;&#65292;&#30452;&#21040; <code>mutex</code> &#25152;&#25351;&#21521;&#30340;&#20114;&#26021;&#34987;&#38145;&#65292;&#25110;&#30452;&#21040;&#25269;&#36798; <code>time_point</code> &#25152;&#25351;&#21521;&#30340;&#22522;&#20110; <span class="t-c"><span class="mw-geshi c source-c">TIME_UTC</span></span> &#30340;&#26102;&#38388;&#28857;&#12290;</p>
<p>&#33509;&#24403;&#21069;&#32447;&#31243;&#24050;&#32463;&#38145;&#23450;&#35813;&#20114;&#26021;&#19988;&#35813;&#20114;&#26021;&#38750;&#36882;&#24402;&#65292;&#21017;&#34892;&#20026;&#26410;&#23450;&#20041;&#12290;</p>
<p>&#33509;&#35813;&#20114;&#26021;&#19981;&#25903;&#25345;&#26102;&#38480;&#65292;&#21017;&#34892;&#20026;&#26410;&#23450;&#20041;&#12290;</p>
<p>&#20808;&#21069;&#22312;&#21516;&#19968;&#20114;&#26021;&#19978;&#23545; <span class="t-lc"><a href="c-thread-mtx_unlock.html">mtx_unlock</a></span> &#30340;&#35843;&#29992;<i>&#21516;&#27493;&#20110;</i>&#27492;&#25805;&#20316;&#65288;&#33509;&#27492;&#25805;&#20316;&#25104;&#21151;&#65289;&#65292;&#32780;&#19988;&#20219;&#20309;&#32473;&#23450;&#30340;&#20114;&#26021;&#19978;&#30340;&#25152;&#26377;&#38145;&#23450;/&#35299;&#38145;&#32452;&#25104;&#21333;&#29420;&#20840;&#24207;&#65288;&#31867;&#20284;&#21407;&#23376;&#23545;&#35937;&#19978;&#30340;&#20462;&#25913;&#39034;&#24207;&#65289;&#12290;</p>
<h3><span class="mw-headline" id=".E5.8F.82.E6.95.B0">&#21442;&#25968;</span></h3>
<table class="t-par-begin">
<tr class="t-par">
<td>mutex</td>
<td>-</td>
<td>&#25351;&#21521;&#35201;&#38145;&#23450;&#30340;&#20114;&#26021;&#30340;&#25351;&#38024;</td>
</tr>
<tr class="t-par">
<td>time_point</td>
<td>-</td>
<td>&#25351;&#21521;&#35201;&#31561;&#24453;&#21040;&#30340;&#26102;&#38480;&#26102;&#38388;&#28857;&#30340;&#25351;&#38024;</td>
</tr>
</table>
<h3><span class="mw-headline" id=".E8.BF.94.E5.9B.9E.E5.80.BC">&#36820;&#22238;&#20540;</span></h3>
<p>&#33509;&#25104;&#21151;&#21017;&#20026; <span class="t-lc"><a href="c-thread-thrd_errors.html">thrd_success</a></span> &#65292;&#33509;&#24050;&#22312;&#38145;&#23450;&#20114;&#26021;&#21069;&#25269;&#36798;&#26102;&#38480;&#21017;&#20026; <span class="t-c"><span class="mw-geshi c source-c">thrd_timedout</span></span> &#65292;&#33509;&#20986;&#29616;&#38169;&#35823;&#21017;&#20026; <span class="t-lc"><a href="c-thread-thrd_errors.html">thrd_error</a></span> &#12290;</p>
<h3><span class="mw-headline" id=".E5.BC.95.E7.94.A8">&#24341;&#29992;</span></h3>
<div class="t-ref-std-11">
<ul>
<li>C11 &#26631;&#20934;&#65288;ISO/IEC 9899:2011&#65289;&#65306;</li>
</ul>
<dl>
<dd>
<ul>
<li>7.26.4.4 The mtx_timedlock function (p: 381-382)</li>
</ul>
</dd>
</dl>
</div>
<h3><span class="mw-headline" id=".E5.8F.82.E9.98.85">&#21442;&#38405;</span></h3>
<table class="t-dsc-begin">
<tr class="t-dsc">
<td>
<div class="t-dsc-member-div">
<div><a href="c-thread-mtx_lock.html"><span class="t-lines"><span>mtx_lock</span></span></a></div>
<div><span class="t-lines"><span><span class="t-mark-rev t-since-c11">(C11)</span></span></span></div>
</div>
</td>
<td>&#38459;&#22622;&#21040;&#38145;&#23450;&#20114;&#26021;&#20026;&#27490;<br />
<span class="t-mark">(&#20989;&#25968;)</span></td>
</tr>
<tr class="t-dsc">
<td>
<div class="t-dsc-member-div">
<div><a href="c-thread-mtx_trylock.html"><span class="t-lines"><span>mtx_trylock</span></span></a></div>
<div><span class="t-lines"><span><span class="t-mark-rev t-since-c11">(C11)</span></span></span></div>
</div>
</td>
<td>&#38145;&#23450;&#20114;&#26021;&#65292;&#33509;&#24050;&#38145;&#23450;&#21017;&#36820;&#22238;&#32780;&#19981;&#38459;&#22622;<br />
<span class="t-mark">(&#20989;&#25968;)</span></td>
</tr>
<tr class="t-dsc">
<td>
<div class="t-dsc-member-div">
<div><a href="c-thread-mtx_unlock.html"><span class="t-lines"><span>mtx_unlock</span></span></a></div>
<div><span class="t-lines"><span><span class="t-mark-rev t-since-c11">(C11)</span></span></span></div>
</div>
</td>
<td>&#35299;&#38145;&#20114;&#26021;<br />
<span class="t-mark">(&#20989;&#25968;)</span></td>
</tr>
</table>
</div>
<div class="visualClear"></div>
</div>
</div>
</div>
</body>
</html>