On Wed, 22 Jan 2025 12:26:45 GMT, Matthias Ernst <d...@openjdk.org> wrote:

>> Isn't the problem access? E.g. a virtual thread `A` running on our carrier 
>> thread might create the confined arena, binding it to _virtual_ thread `A`, 
>> and then another virtual thread `B` comes along one the same carrier thread, 
>> and wants to use the same `BufferStack`, but can't because it is confined to 
>> thread `A`.
>
> I think _using_ it might even be ok, since all it does to the stack is 
> slicing and reinterpreting, but the final close() would be on the wrong 
> thread (allocator = virtual, closer=terminator likely a platform thread).

So:
* the shared memory segment is confined on the carrier thread
* allocation requests need to reinterpret segment slices to the arena (which is 
associated with the requesting thread, not the carrier)
* my understanding is that the terminating action will be executed on the same 
carrier thread (so closing the confined arena should be ok)

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

PR Review Comment: https://git.openjdk.org/jdk/pull/23142#discussion_r1926899199

Reply via email to