On Tue, 29 Mar 2022 20:05:50 GMT, Mandy Chung <mch...@openjdk.org> wrote:

> A small improvement to `RawNativeLibraries`.   `RawNativeLibraries::load` 
> returns the same `NativeLibrary` instance of a given path if it's called 
> multiple times. This means that multiple clients have to coordinate that the 
> last one using the loaded library is the one to close the library by calling 
> `RawNativeLibraries::unload`; otherwise, an exception may be thrown.
> 
> This patch changes `RawNativeLibraries::load` to delegate to the underlying 
> platform-specific library loading mechanism e.g. dlopen/dlclose that keeps 
> the reference count.  So each call to `RawNativeLibraries::load` and `unload` 
> is simply a call to dlopen and dlclose respectively.  Each client of calling 
> `RawNativeLibraries::load` is responsible for calling 
> `RawNativeLibraries::unload`.  This will be consistent with the current 
> behavior when you call `load` and `unload` with a different 
> `RawNativeLibraries` instance.

LGTM

-------------

Marked as reviewed by sundar (Reviewer).

PR: https://git.openjdk.java.net/jdk/pull/8022

Reply via email to