Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 9fad128a authored by Dimitry Ivanov's avatar Dimitry Ivanov Committed by android-build-merger
Browse files

Merge "nativeloader: Add CloseNativeLibrary() method"

am: ad717d65

* commit 'ad717d65':
  nativeloader: Add CloseNativeLibrary() method

Change-Id: Id4a0937a32afe189c5cb46367d91a2aeebbfb71d
parents ee320256 ad717d65
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -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.
+4 −0
Original line number Diff line number Diff line
@@ -241,6 +241,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);