RFR: 8307483: New micros for j.u.c.LockSupport
David Holmes
dholmes at openjdk.org
Mon May 8 06:01:15 UTC 2023
On Fri, 5 May 2023 14:31:29 GMT, Alan Bateman <alanb at openjdk.org> wrote:
>> These micros were developed while investigating JDK-8305670 by myself and Sergey Kuksenko. The order of thread creation was important in that bug, so there are 2 JMH for creating sleepers before and after the worker threads.
>
> test/micro/org/openjdk/bench/java/util/concurrent/UnparkBenchSleepersAfter.java line 131:
>
>> 129: public void run() {
>> 130: my_thread = Thread.currentThread();
>> 131: while (!done) {
>
> You might want to re-check IdleThread. From a quick look I would have expected "done" to be volatile. Also "my_thread" as it is set in the run with plain access.
Yes `done` must be volatile. Surprised this even worked as expected.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/13815#discussion_r1187052047
More information about the core-libs-dev
mailing list