<div dir="ltr"><div dir="ltr"><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Sep 20, 2024 at 12:44 PM David Holmes <<a href="mailto:dholmes@openjdk.org">dholmes@openjdk.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex">On Fri, 20 Sep 2024 08:05:20 GMT, Simon Tooke <<a href="mailto:stooke@openjdk.org" target="_blank">stooke@openjdk.org</a>> wrote:<br>
<br>
>> I would prefer it here, or in HANDLE_THREAD macro, to make sure we do this for all threads printed.<br>
><br>
> I will put it in HANDLE_THREAD to cover the other tests.<br>
<br>
It is not needed for the other tests - those threads can't be new.<br>
<br>
This is an issue with using the JavaThread iterator so should be visibly seen in the itertation loop IMO.<br>
<br></blockquote><div><br></div><div>I don't think this is limited to JavaThread</div><div><br></div><div>Eg in G1:</div><br>- parent thread calls WorkerThreads::set_active_workers<br>- WorkerThreads::set_active_workers creates thread (A), starts thread (B), sets them into the workers array (C)<br>- from point (C) on they are observable and WorkerThreads::threads_do will iterate them<br>- Child thread starts running at (B), but I don't see any way to guarantee that initialization is finished before another thread can observe it via WorkerThreads::threads_do.</div><div class="gmail_quote"><br></div><div class="gmail_quote">Admittedly, this is improbable. But why risk it? We don't lose anything by just testing printing for every thread.</div><div class="gmail_quote"><br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex">
-------------<br>
<br>
PR Review Comment: <a href="https://git.openjdk.org/jdk/pull/21091#discussion_r1768387573" rel="noreferrer" target="_blank">https://git.openjdk.org/jdk/pull/21091#discussion_r1768387573</a><br>
</blockquote></div></div>