https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96817
--- Comment #13 from Jonathan Wakely <redi at gcc dot gnu.org> --- (In reply to Yuxuan Shui from comment #1) > Example: > > This program normally deadlocks when using linked pthread: > > https://godbolt.org/z/Yrza4e > > But it will throw recursive_init_error when using dlopen'd pthread: > > https://godbolt.org/z/afMe5d I'm not sure what these examples are very helpful. Throwing recursive_init_error is the correct behaviour here, it's a bug that we fail to detect the recursion when it happens in the same thread.