[foreign-jextract] RFR: MemorySegmentPool + Allocator [v7]

Maurizio Cimadamore mcimadamore at openjdk.java.net
Thu Apr 22 00:02:27 UTC 2021


On Wed, 21 Apr 2021 23:38:36 GMT, Radoslaw Smogura <github.com+7535718+rsmogura at openjdk.org> wrote:

> I think the method addOrCleanUpIfFail should be a public API. I think it could provide some argument indicating reason of calling (clean up or fail in clean up), or the clean up callback interface could be split into two methods cleanup and fail. Just an observation.

I get what you mean - for now I didn't want to give guaranteed call of cleanup actions added by user. That can be achieved using acquire.

As for distinguishing as to whether a cleanup as been called as a result of close() or fail, I don't think that matters: when you have 10 threads racing for the same segment - are you gonna able to distinguish between:

* I tried to add a cleanup action, but the "add" failed, and the cleanup was called
* the segment was closed immediately after I added the cleanup action

I don't think this is a material difference. In both cases, misbehavior signals a lack of adequate countermeasures in user code, IMHO.

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

PR: https://git.openjdk.java.net/panama-foreign/pull/509


More information about the panama-dev mailing list