On Wed, 7 Jun 2023 23:08:52 GMT, Serguei Spitsyn <sspit...@openjdk.org> wrote:
>>> A thread carrying a virtual thread can not be in native, blocked, parked, >>> sleeping or waiting on some object. >> >> Actually it can be in native. >> And if I remember correctly synchronized block pins virtual thread, so >> inside synchronized we can get other states > > The INTERRUPTED bit we need has to be returned by the > `java_lang_Thread::get_thread_status`. > Not completely sure but the bit jt->is_interrupted(false) can be set for the > mounted virtual thread. > The JVMTI InterruptThread calls this function to set interrupt bit for > non-virtual threads: > ` java_lang_Thread::set_interrupted(thread_obj, true);` Corrected the function `get_thread_state()` to make it more safe. Only `ALIVE` and `INTERRUPTED` bits are taken from result of `java_lang_Thread::get_thread_status(thread_oop)`. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/14366#discussion_r1222352148