Do not destruct static maps.
In case they are deleted while some threads are using them (this
happens sometimes depending on how these libraries are loaded and how
they are being used).
Noting that b/69122224 is filed to move these into functions.
Bug: 129726097
Test: HIDL's run_all_device_tests.sh
Test: no longer see error where it repro'd before:
FORTIFY: pthread_mutex_lock called on a destroyed mutex
Change-Id: I66eb9aa24e31d7fc652f0426361c17600b4716ec
diff --git a/transport/InternalStatic.h b/transport/InternalStatic.h
index b0fefa9..1dfaae4 100644
--- a/transport/InternalStatic.h
+++ b/transport/InternalStatic.h
@@ -26,10 +26,12 @@
namespace hardware {
namespace details {
+// TODO(b/69122224): remove this
// deprecated; use getBnConstructorMap instead.
-extern BnConstructorMap gBnConstructorMap;
+extern DoNotDestruct<BnConstructorMap> gBnConstructorMap;
+// TODO(b/69122224): remove this
// deprecated; use getBsConstructorMap instead.
-extern BsConstructorMap gBsConstructorMap;
+extern DoNotDestruct<BsConstructorMap> gBsConstructorMap;
} // namespace details
} // namespace hardware