MemorySegment - request ownership - release ownership - ownership strategy

Suminda Sirinath Salpitikorala Dharmasena sirinath1978m at gmail.com
Sat Dec 12 16:59:33 UTC 2020


Hello,

An API which can be added to MemorySegment is to:
- request ownership and
- release ownership (internally may set withOwnerThread(null))

A thread requesting ownership will block until the ownership assigned to
the calling thread. Requests will be served according to a strategy which
can be:
- FIFO
- Random
- Prioritised by threads which had the least ownership of the segment
- etc.

This way the transfer of ownership would be systematic.

Also the MemorySegment and ownerships strategy can determine the next owner
if the ownership is released without setting an owner explicitly and there
are no requests for ownership pending.

So the new APIs would be:
- releaseOwnership()
- requestOwnership()
- setOwnershipStratergy(strategy)

Suminda


More information about the panama-dev mailing list