mutex: Switch the POSIX backend to PTHREAD_MUTEX_RECURSIVE
The code for recursive mutexes triggered Undefined Behavior and crash as pthread_equal(3) was not used in a portable way. On the first call of mutex_lock() pthread_equal() was called with a pthread_t of value -1 which is invalid.
Passing a non valid thread ID to pthread_equal is undefined.
Switch the backend to native interface for POSIX recursive mutexes with PTHREAD_MUTEX_RECURSIVE and simplify the code.
Detected on NetBSD/amd64 9.99.46.
Signed-off-by: Marvin Scholz email@example.com