On Mon, 24 Jan 2022 21:32:16 GMT, Peter Levart <plev...@openjdk.org> wrote:

> This looks good, although I don't know whether the additional check for 
> strongReferent != null is needed in clearStrong(). This is all racy code and 
> you have already got a non-null return from getStrong() in case you are 
> calling clearStrong()...

This seems like a standard thing to do to avoid multi-threaded write contention 
under the race. By the time one thread calls `clearStrong`, some other thread 
might have already cleared it, and we don't have to clear again. Granted, that 
is a micro-optimization, but I'd like to avoid surprises on this path :)

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

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

Reply via email to