[foreign-abi] RFR: 8253823: Investigate ways to make handoff-like operation more explicit [v2]
Jorn Vernee
jvernee at openjdk.java.net
Wed Sep 30 12:24:43 UTC 2020
On Wed, 30 Sep 2020 12:17:11 GMT, Maurizio Cimadamore <mcimadamore at openjdk.org> wrote:
>> src/jdk.incubator.foreign/share/classes/jdk/incubator/foreign/MemorySegment.java line 409:
>>
>>> 407: * hand-over from the current owner thread to the new owner thread, which in turn <i>happens before</i> read
>>> accesses 408: * to the returned segment's contents on the new owner thread.
>>> 409: *
>>
>> Maybe it's worth mentioning here and for the other overload that cleanup actions are not run when doing a handoff, and
>> they are instead transferred to the new segment. While Cleaners registered to the old segment will have no effect
>> anymore, and will have to be re-registered to the new segment.
>
> So, mentioning that cleanup actions are called on `MemorySegment#close` is a good thing.
> Regarding Cleaners - your comment makes me wonder - cleaners are the only thing that is NOT propagated, should we
> propagate them for consistency; this way what you get out of handoff is a segment that has SAME characteristics as old
> segment - except some _additional_ stuff and, possibly, a different owner thread.
I think if we can propagate them (technically), we should. I don't know if there's a way to unregister them from the
old scope as well? (i.e. prevent unecessary cleaner thread churn)
-------------
PR: https://git.openjdk.java.net/panama-foreign/pull/361
More information about the panama-dev
mailing list