RFR: 8269417: Minor clarification on NonblockingQueue utility

Kim Barrett kbarrett at openjdk.java.net
Sun Jun 27 00:37:04 UTC 2021


On Sat, 26 Jun 2021 02:29:20 GMT, Man Cao <manc at openjdk.org> wrote:

> Hi,
> 
> Could you review this change mainly based on the comments in https://github.com/openjdk/jdk/pull/4379?
> I also added an assertion to ensure and better understand why the Atomic::store() in append() is correct.
> 
> Stress tested with fastdebug build with:
> $ make test TEST="gtest:NonblockingQueueTestBasics gtest:NonblockingQueueTest" GTEST="REPEAT=-1"

Looks good.  Just one suggestion in commentary.

src/hotspot/share/utilities/nonblockingQueue.inline.hpp line 116:

> 114:     // _head simultaneously, because the Atomic::xchg() above orders these
> 115:     // push/append operations so they perform Atomic::cmpxchg() on different
> 116:     // old_tail. Thus, at most one Atomic::cmpxchg() can fail.

s/Thus, ... fail./Thus, the cmpxchg can only fail because of a concurrent try_pop./

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

Marked as reviewed by kbarrett (Reviewer).

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


More information about the hotspot-dev mailing list