---
name: "futex_proxy_trylock_atomic"
section: "9"
platform: "linux"
package: "linux-manual-4.9"
version: "4.9.228-1"
release: "Debian 9 (Stretch)"
platforms: ["linux"]
url: "https://new.carta.tech/futex_proxy_trylock_atomic"
---

# futex\_proxy\_trylock\_atomic(9)

Attempt an atomic lock for the top waiter

## NAME

futex\_proxy\_trylock\_atomic - Attempt an atomic lock for the top waiter

## SYNOPSIS

**int futex\_proxy\_trylock\_atomic(u32 \_\_user \*** *pifutex***, struct futex\_hash\_bucket \*** *hb1***, struct futex\_hash\_bucket \*** *hb2***, union futex\_key \*** *key1***, union futex\_key \*** *key2***, struct futex\_pi\_state \*\*** *ps***, int** *set\_waiters***);**

## ARGUMENTS

*pifutex*

the user address of the to futex

*hb1*

the from futex hash bucket, must be locked by the caller

*hb2*

the to futex hash bucket, must be locked by the caller

*key1*

the from futex key

*key2*

the to futex key

*ps*

address to store the pi\_state pointer

*set\_waiters*

force setting the FUTEX\_WAITERS bit (1) or not (0)

## DESCRIPTION

Try and get the lock on behalf of the top waiter if we can do it atomically. Wake the top waiter if we succeed. If the caller specified set\_waiters, then direct **futex\_lock\_pi\_atomic** to force setting the FUTEX\_WAITERS bit. hb1 and hb2 must be held by the caller.

## RETURN

0 - failed to acquire the lock atomically; \>0 - acquired the lock, return value is vpid of the top\_waiter \<0 - error

## AUTHOR

**Rusty Russell** \<rusty@rustcorp.com.au\>

Author.

## COPYRIGHT
