On Mon, 19 Oct 2026 19:07:08 GMT, Patrick Fontanilla <[email protected]> 
wrote:

>> src/hotspot/share/services/diagnosticWorkers.cpp line 43:
>> 
>>> 41:     // Use release_store() because the error reporter can read _workers 
>>> while
>>> 42:     // the pool is being created.
>>> 43:     _workers.release_store(pool);
>> 
>> Yeah, but concurrent calls to this method would leak one instance of 
>> `WorkerThreads`. You need to CAS the instance and free the instance that 
>> lost the installation race.
>
> Does it really need CAS? Creating the pool is always done by the VM thread, 
> so it should be thread safe, right?

Yes, _now_ it is done by a single thread. CAS provides defense in depth for 
future uses. You can do a CAS and then assert that no conflicts have happened.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/33218#discussion_r4322354816

Reply via email to