RFR: 8317514: Ensure MemorySegment is initialized before touching NativeMemorySegmentImpl [v2]

Per Minborg pminborg at openjdk.org
Fri Oct 13 17:48:09 UTC 2023


On Fri, 13 Oct 2023 17:31:15 GMT, Maurizio Cimadamore <mcimadamore at openjdk.org> wrote:

>> This PR makes sure that `MemorySegment` is initialized *before* any of its subclasses.
>> This is done by centralizing all the memory segment factories in a single implementation class (`SegmentFactories`).
>> Doing so addresses a possible deadlock condition when using multiple threads.
>
> Maurizio Cimadamore has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Address review comments

src/java.base/share/classes/jdk/internal/foreign/SegmentFactories.java line 49:

> 47:  */
> 48: public class SegmentFactories {
> 49: 

We could make this a proper utility class by declaring the class final and having a private constructor.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/16187#discussion_r1358610000


More information about the core-libs-dev mailing list