The e-mail from maurizio.cimadamore@oracle.com:
I'm writing this email as I recall that we disabled some tests in JDK 15, because a method, namely MemorySegment::acquire was removed from the API, so segments were not accessible from multiple threads.
This functionality is now back in the recently pushed code, but in a new form - instead of acquiring segments, you just have to "share" them - e.g:
MemorySegment segment = MemorySegment.allocateNative(100).share();
The segment created above does NOT have any owner thread and can thus be accessed and closed (safely!) from multiple threads.
Since we rely on a lot of black magic to support this (:-) ) I think it would be a good idea to edit the acquire-based test and move them to the new API, so that we can stress test this feature.
I'm writing this email as I recall that we disabled some tests in JDK 15, because a method, namely MemorySegment::acquire was removed from the API, so segments were not accessible from multiple threads.
This functionality is now back in the recently pushed code, but in a new form - instead of acquiring segments, you just have to "share" them - e.g:
MemorySegment segment = MemorySegment.allocateNative(100).share();
The segment created above does NOT have any owner thread and can thus be accessed and closed (safely!) from multiple threads.
Since we rely on a lot of black magic to support this (:-) ) I think it would be a good idea to edit the acquire-based test and move them to the new API, so that we can stress test this feature.