On Fri, 15 Oct 2021 22:04:16 GMT, Daniel D. Daugherty <dcu...@openjdk.org> wrote:
>> src/hotspot/share/runtime/thread.cpp line 497: >> >>> 495: // placement somewhere in the calling context. >>> 496: bool Thread::is_JavaThread_protected_by_my_ThreadsList(const >>> JavaThread* p) { >>> 497: Thread* current_thread = Thread::current(); >> >> Shouldn't you call this on the current thread as "this" argument? > > I modeled the new check after the existing: > > > bool Thread::is_JavaThread_protected(const JavaThread* p) { > > > which is also a static function. While the name is somewhat ungainly - and unnecessarily detailed given `is_JavaThread_protected` has a similar constraint - it should be a static function as given because it must only be called on the current thread, and an instance method would give the false impression that it could be called on any thread. That said it should be possible to write that code block only once and reuse it. And the name as I said is somewhat ungainly. You could even have: static bool is_JavaThread_protected(const JavaThread* p, bool checkTLHOnly = false) { ------------- PR: https://git.openjdk.java.net/jdk/pull/4677