Mutexes are used to protect shared data structures being concurrently accessed. If a mutex is destroyed while a thread is blocked waiting for that mutex, critical sections and shared data are no longer protected.
The C Standard, 7.2628.4.1, paragraph 2 [ISO/IEC 9899:20112024], states
The
mtx_destroyfunction releases any resources used by the mutex pointed to bymtx. No threads can be blocked waiting for the mutex pointed to bymtx.
...
Bibliography
| [ISO/IEC 9899:20112024] | 7.2628.4.1, "The mtx_destroy Function" |
...