Revert "Revert "Unload oat files""
Fixed a race where two threads calling OatFile::Open could both use
dlopen on the host.
Bug: 22720414
This reverts commit 72da5e7461fec3b1e116050f2e6f233efb9c54f3.
Change-Id: I1636045b724944d2a09417527280784967957095
diff --git a/runtime/base/mutex.h b/runtime/base/mutex.h
index 17f6a03..d4c9057 100644
--- a/runtime/base/mutex.h
+++ b/runtime/base/mutex.h
@@ -83,6 +83,7 @@
kDexFileToMethodInlinerMapLock,
kInternTableLock,
kOatFileSecondaryLookupLock,
+ kOatFileCountLock,
kOatFileManagerLock,
kTracingUniqueMethodsLock,
kTracingStreamingLock,
@@ -648,8 +649,11 @@
// Guards opened oat files in OatFileManager.
static ReaderWriterMutex* oat_file_manager_lock_ ACQUIRED_AFTER(modify_ldt_lock_);
+ // Guards opened oat files in OatFileManager.
+ static ReaderWriterMutex* oat_file_count_lock_ ACQUIRED_AFTER(oat_file_manager_lock_);
+
// Guards intern table.
- static Mutex* intern_table_lock_ ACQUIRED_AFTER(oat_file_manager_lock_);
+ static Mutex* intern_table_lock_ ACQUIRED_AFTER(oat_file_count_lock_);
// Guards reference processor.
static Mutex* reference_processor_lock_ ACQUIRED_AFTER(intern_table_lock_);