1<html><head><meta http-equiv="Content-Type" content="text/html; charset=ANSI_X3.4-1968"><title>futex_proxy_trylock_atomic</title><meta name="generator" content="DocBook XSL Stylesheets V1.78.1"><link rel="home" href="index.html" title="Unreliable Guide To Locking"><link rel="up" href="apiref-futex.html" title="Chapter 12. Futex API reference"><link rel="prev" href="API-requeue-pi-wake-futex.html" title="requeue_pi_wake_futex"><link rel="next" href="API-futex-requeue.html" title="futex_requeue"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center"><span class="phrase">futex_proxy_trylock_atomic</span></th></tr><tr><td width="20%" align="left"><a accesskey="p" href="API-requeue-pi-wake-futex.html">Prev</a> </td><th width="60%" align="center">Chapter 12. Futex API reference</th><td width="20%" align="right"> <a accesskey="n" href="API-futex-requeue.html">Next</a></td></tr></table><hr></div><div class="refentry"><a name="API-futex-proxy-trylock-atomic"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>futex_proxy_trylock_atomic — 2 Attempt an atomic lock for the top waiter 3 </p></div><div class="refsynopsisdiv"><h2>Synopsis</h2><div class="funcsynopsis"><table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"><tr><td><code class="funcdef">int <b class="fsfunc">futex_proxy_trylock_atomic </b>(</code></td><td>u32 __user * <var class="pdparam">pifutex</var>, </td></tr><tr><td> </td><td>struct futex_hash_bucket * <var class="pdparam">hb1</var>, </td></tr><tr><td> </td><td>struct futex_hash_bucket * <var class="pdparam">hb2</var>, </td></tr><tr><td> </td><td>union futex_key * <var class="pdparam">key1</var>, </td></tr><tr><td> </td><td>union futex_key * <var class="pdparam">key2</var>, </td></tr><tr><td> </td><td>struct futex_pi_state ** <var class="pdparam">ps</var>, </td></tr><tr><td> </td><td>int <var class="pdparam">set_waiters</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer"> </div></div></div><div class="refsect1"><a name="idp1124861884"></a><h2>Arguments</h2><div class="variablelist"><dl class="variablelist"><dt><span class="term"><em class="parameter"><code>pifutex</code></em></span></dt><dd><p> 4 the user address of the to futex 5 </p></dd><dt><span class="term"><em class="parameter"><code>hb1</code></em></span></dt><dd><p> 6 the from futex hash bucket, must be locked by the caller 7 </p></dd><dt><span class="term"><em class="parameter"><code>hb2</code></em></span></dt><dd><p> 8 the to futex hash bucket, must be locked by the caller 9 </p></dd><dt><span class="term"><em class="parameter"><code>key1</code></em></span></dt><dd><p> 10 the from futex key 11 </p></dd><dt><span class="term"><em class="parameter"><code>key2</code></em></span></dt><dd><p> 12 the to futex key 13 </p></dd><dt><span class="term"><em class="parameter"><code>ps</code></em></span></dt><dd><p> 14 address to store the pi_state pointer 15 </p></dd><dt><span class="term"><em class="parameter"><code>set_waiters</code></em></span></dt><dd><p> 16 force setting the FUTEX_WAITERS bit (1) or not (0) 17 </p></dd></dl></div></div><div class="refsect1"><a name="idp1124869444"></a><h2>Description</h2><p> 18 Try and get the lock on behalf of the top waiter if we can do it atomically. 19 Wake the top waiter if we succeed. If the caller specified set_waiters, 20 then direct <code class="function">futex_lock_pi_atomic</code> to force setting the FUTEX_WAITERS bit. 21 hb1 and hb2 must be held by the caller. 22</p></div><div class="refsect1"><a name="idp1124870612"></a><h2>Return</h2><p> 23 0 - failed to acquire the lock atomically; 24 >0 - acquired the lock, return value is vpid of the top_waiter 25 <0 - error 26</p></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="API-requeue-pi-wake-futex.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="apiref-futex.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="API-futex-requeue.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top"><span class="phrase">requeue_pi_wake_futex</span> </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> <span class="phrase">futex_requeue</span></td></tr></table></div></body></html> 27