Follow-up from "Resolve "Dig fails to cleanup OpenSSL references""
The following discussion from !7535 (merged) should be addressed:
-
@ondrej started a discussion: (+1 comment) I was thinking that this code might go into the library destructor with ease - we just need a single global atomic bool to indicate where we need deinit and add a wrapper with
atomic_compare_exchange()
to thedst_lib_destroy()
, so it doesn't get run twice. That would solve the de-init for all uses ofdst_lib_init()
(which can't be run from the constructor because of the ENGINE initialization).