On 06/18/2018 11:22 AM, Martin Buchholz wrote: > Or better, lockField.set in resetLock could instead be setRelease. > Except it is using reflection, not VarHandles. So it could be preceded > with VarHandle.releaseFence(), although it is hard to think of a > scenario in which it could matter. > > > You mean followed by, not preceded by? > > try { > lockField.set(this, new Object()); > + java.lang.invoke.VarHandle.releaseFence(); > } catch (IllegalAccessException e) { > throw new Error(e); > } >
OK. Followed by is a little better in that it orders any field write before any write of this, not just the array copy before lock field write. -Doug