You don't actually need a mutex because calls to dlopen/dlclose are already globally serialized by the runtime linker, i.e. there is always only one thread calling _d_dso_registry.