Ensure that threading library is initialized in pthread_mutex_init().

We need at least thr_malloc ready.  The situation is possible e.g. in case
of libthr being listed in DT_NEEDED before some of its consumers.

Reported and tested by:	lev
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
This commit is contained in:
Konstantin Belousov 2020-11-30 17:00:36 +00:00
parent 991f23ef20
commit ec5fed758c

View File

@ -384,6 +384,8 @@ __Tthr_mutex_init(pthread_mutex_t * __restrict mutex,
struct pthread_mutex *pmtx;
int ret;
_thr_check_init();
if (mutex_attr != NULL) {
ret = mutex_check_attr(*mutex_attr);
if (ret != 0)