On Sun, 17 Oct 2021 12:45:59 GMT, David Holmes <dhol...@openjdk.org> wrote:
>> 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) { I'm checking out adding the `checkTLHOnly` param to `is_JavaThread_protected()` and replacing `is_JavaThread_protected_by_my_ThreadsList()` calls with calls to the updated function. ------------- PR: https://git.openjdk.java.net/jdk/pull/4677