nativeloader: Add CloseNativeLibrary() method

This method is called by art on UnloadNativeLibraries()

Bug: http://b/28406866
Change-Id: Ibccff93c83d6ccd3d0a1c0294a64b09281b4e05e
(cherry picked from commit 09a516bf16)
This commit is contained in:
Dimitry Ivanov 2016-05-03 14:55:25 -07:00
parent bfd6a0f24d
commit 7a1f9518f7
2 changed files with 7 additions and 0 deletions

View File

@ -43,6 +43,9 @@ void* OpenNativeLibrary(JNIEnv* env,
jobject class_loader,
jstring library_path);
__attribute__((visibility("default")))
bool CloseNativeLibrary(void* handle);
#if defined(__ANDROID__)
// Look up linker namespace by class_loader. Returns nullptr if
// there is no namespace associated with the class_loader.

View File

@ -231,6 +231,10 @@ void* OpenNativeLibrary(JNIEnv* env,
#endif
}
bool CloseNativeLibrary(void* handle) {
return dlclose(handle) == 0;
}
#if defined(__ANDROID__)
android_namespace_t* FindNamespaceByClassLoader(JNIEnv* env, jobject class_loader) {
std::lock_guard<std::mutex> guard(g_namespaces_mutex);