RFR: JDK-8278309: [windows] use of uninitialized OSThread::_state

Thomas Stuefe stuefe at openjdk.java.net
Tue Dec 7 13:34:16 UTC 2021


On Tue, 7 Dec 2021 13:22:27 GMT, Aleksey Shipilev <shade at openjdk.org> wrote:

> This looks fine as the limited fix.
> 
> But I do wonder if the initial state `ALLOCATED` should be stamped right in the `OSThread::OSThread` constructor. 

Oh totally. This makes me itch. But I wanted a minimal patch to downport, and knowing me once I start touching OSThread I can't stop pulling threads. Ideally, I would like to get rid of OSThread altogether and merge it into Thread; there is no reason to have two physically separate structures like this.

> Also, I see other platforms, for example, Linux does:
> 
> ```
>   // set the correct thread state
>   osthread->set_thread_type(thr_type);
> 
>   // Initial state is ALLOCATED but not INITIALIZED
>   osthread->set_state(ALLOCATED);
> ```
> 
> Not sure how safe it is to add `set_thread_type`, but matching the comment for `set_state` is probably in order.

Windows does not have a thread type. About the comment, sure, I can do that. Will do it before pushing.

Thanks, Thomas

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

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


More information about the hotspot-dev mailing list