Thread safety check of MemorySegment

虾米Mickey xiami at mickey.moe
Tue Jul 21 13:54:49 UTC 2020


Hi, I am using foreign to develop indie games.
A library called bgfx is used.

There is a function, https://bkaradzic.github.io/bgfx/bgfx.html#_CPPv4N4bgfx7makeRefEPKv8uint32_t9ReleaseFnPv
There is a clear requirement for the incoming memory release callback: ReleaseFn function must be able to be called from any thread.

Due to MemorySegmentImpl::close -> MemorySegmentImpl::checkValidState, this will result in IllegalStateException("Attempt to access segment outside owning thread")

Currently I release the memory through segment.scope().close(), of course this is not a direct call.
Should there be a more direct way to release operations under unsafe conditions?

Thanks and regards,

NekoCaffeine


More information about the panama-dev mailing list