mtx_trylock from mtx.c in libstdthreads calls pthread_mutex_lock instead of pthread_mutex_trylock and thus is blocking.
Created attachment 153543 [details] Use pthread_mutex_trylock(). This is the typo, code correctly tests for EBUSY, but called wrong function. Please test.
Comment on attachment 153543 [details] Use pthread_mutex_trylock(). Works fine. Thank you.
A commit references this bug: Author: kib Date: Thu Feb 26 16:39:57 UTC 2015 New revision: 279326 URL: https://svnweb.freebsd.org/changeset/base/279326 Log: Use pthread_mutex_trylock(3) to implement mtx_trylock(3). Noted and tested by: Vineela <vineela_17@yahoo.com> PR: 198050 Sponsored by: The FreeBSD Foundation MFC after: 1 week Changes: head/lib/libstdthreads/mtx.c