Adelsbach Enhanced Threading Library

Manual Pages (DD-00013-001)

Enhanced Threading Library > smtx_trylock (3)
HTML TXT PDF PS
smtx_trylock(3) Library Functions Manual smtx_trylock(3)

smtx_trylockattempt to acquire a spinlock

library “threads”
#include <threadse.h>

int
smtx_trylock(smtx_t *s);

The function () will attempt to acquire a spinlock s. If the lock cannot be acquired the function will return a respective return code.

Upon success smtx_trylock() will return thrd_success if the lock has been acquired. If the lock is already acquired thrd_busy will be returned. In case of error thrd_error will be returned.

smtx_init(3) smtx_destroy(3) smtx_lock(3) smtx_unlock(3)

The smtx_trylock() function first appeared in the Adelsbach Enhanced Threading Library.

Jan Adelsbach <jan@jadelsbach.de>

May 9, 2020 Debian