#include int __pthread_mutex_unlock(mtx_t *); int (mtx_unlock)(mtx_t *mtx) { int ret = __pthread_mutex_unlock(mtx); /* In case of UB may also return EPERM. */ return ret ? thrd_error : thrd_success; }