On Thu, 27 Aug 2026 15:15:21 GMT, Alan Bateman <[email protected]> wrote:

>> Per Minborg has updated the pull request incrementally with one additional 
>> commit since the last revision:
>> 
>>   Check both Exception and Error in test
>
> src/java.base/share/classes/jdk/internal/foreign/ConfinedSegmentPool.java 
> line 130:
> 
>> 128:     static long acquire(Thread thread) {
>> 129:         assert thread == Thread.currentThread();
>> 130:         return POOLING_DISABLED ? 0 : 
>> acquireFromCache(cacheOwner(thread));
> 
> It would be safer to pin a virtual thread to its carrier here (same thing in 
> release) to ensure there isn't preemption (it's hard to spot the places where 
> preemption may happen).
> 
> if (Thread.currentThread().isVirtual() && ContinuationSupport.isSupported()) {
>   Continuation.pin();
>   try {
>     return acquireFromCache(JLA.currentCarrierThread());
>   } finally {
>       Continuation.pin();
>   }
> }

The call in the `finally` clause needs to be `Continuation​.unpin()`.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/31365#discussion_r3879180471

Reply via email to