smtx_trylock(3) Library Functions Manual smtx_trylock(3) NAME smtx_trylock – attempt to acquire a spinlock SYNOPSIS library “threads†#include <threadse.h> int smtx_trylock(smtx_t *s); DESCRIPTION The function smtx_trylock() will attempt to acquire a spinlock s. If the lock cannot be acquired the function will return a respective return code. RETURN VALUES 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. SEE ALSO smtx_init(3) smtx_destroy(3) smtx_lock(3) smtx_unlock(3) HISTORY The smtx_trylock() function first appeared in the Adelsbach Enhanced Threading Library. MacOS support was added in version 1.0.1 using an implementation with atomic variables. AUTHORS Jan Adelsbach <jan@jadelsbach.de> Linux 6.13.6-1-default March 30, 2025 Linux 6.13.6-1-default