Multithreaded Programming Guide

Try to Acquire a Mutex

mutex_trylock(3T)

#include <thread.h>

int mutex_trylock(mutex_t *mp);

Use mutex_trylock(3T) to attempt to lock the mutex pointed to by mp. This function is a nonblocking version of mutex_lock(). (For POSIX threads, see "pthread_mutex_trylock(3T)".)