There seems to be no information in the information - but it seems that there are two options:
First, the mutex is initiated using PTHREAD_MUTEX_RECURSIVE , which will block the mutex duels - the number of links is checked, and the mutex is released only when the number of links is 0. This means that you can block the same mutex several times in the same stream, but for that To release it, you must provide the same number of locks.
Secondly, gcc in this version only implements stubs for pthread functions, which means that if you do not add the library binding directive -lpthread , the lock functions will not be implemented. This is confirmed by the fact that after adding the option a deadlock appears.
I will try to go through the GCC source to make sure that this is really the result of the second option - add an update.
NOTE. It is always recommended that you link libraries as it allows you to control the result. Failure to support GCC internally can lead to unexpected behavior, as shown above.
source share