On Wed, 28 Aug 2024 18:22:03 GMT, Sergey Bylokhov <s...@openjdk.org> wrote:
>> Prasanta Sadhukhan has updated the pull request incrementally with one >> additional commit since the last revision: >> >> Reattach thread if AWT is the owner of NSApplication > > src/java.desktop/macosx/native/libosxapp/ThreadUtilities.m line 67: > >> 65: } >> 66: >> 67: + (JNIEnv*)getJNIEnv { > > The cached version of 'getJNIEnv' was added for performance reasons to skip > `attachCurrentThread` if we know for sure that initialization has already > completed. But is it still necessary to track all this flags now, maybe the > `attachCurrentThread` now smart enough to check that the current thread was > already attached, or it is just fast enough? It seems best to make minimal changes in the normal case where AWT creates the toolkit, which this PR does. You raise a good question as to whether we could get rid of the caching entirely. That seems like something to consider in a follow-up. We would need to do measure the performance impact. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/20688#discussion_r1736452484