On Mon, 29 May 2023 02:15:05 GMT, David Holmes <dhol...@openjdk.org> wrote:
> > I have one question though: why wouldn't it be enough to move `vm_created = > > 1` from where we had it before, down to where we now have `vm_created = > > COMPLETE` ? > > Because we need to prevent two threads from concurrently loading and > initializing a VM in the same process. Wouldn't it be less complex to use a lock or some "init once" mechanism (pthread_once) instead of a 3 stage atomic field? Do we really need to know whether the process is in the middle of initialization for any reason other than whether it's actually done? Just to clarify - I'm OK with the fix you have proposed, I was just curious if you considered any other alternatives. ------------- PR Comment: https://git.openjdk.org/jdk/pull/14139#issuecomment-1568554708