< prev index next >

src/java.base/share/classes/java/util/concurrent/locks/AbstractQueuedLongSynchronizer.java

Print this page
8234131: Miscellaneous changes imported from jsr166 CVS 2020-12
Reviewed-by: martin

*** 38,47 **** --- 38,48 ---- import java.util.ArrayList; import java.util.Collection; import java.util.Date; import java.util.concurrent.TimeUnit; import java.util.concurrent.ForkJoinPool; + import java.util.concurrent.RejectedExecutionException; import jdk.internal.misc.Unsafe; /** * A version of {@link AbstractQueuedSynchronizer} in * which synchronization state is maintained as a {@code long}.
*** 1195,1211 **** */ public final void awaitUninterruptibly() { ConditionNode node = new ConditionNode(); long savedState = enableWait(node); LockSupport.setCurrentBlocker(this); // for back-compatibility ! boolean interrupted = false; while (!canReacquire(node)) { if (Thread.interrupted()) interrupted = true; else if ((node.status & COND) != 0) { try { ForkJoinPool.managedBlock(node); } catch (InterruptedException ie) { interrupted = true; } } else Thread.onSpinWait(); // awoke while enqueuing --- 1196,1217 ---- */ public final void awaitUninterruptibly() { ConditionNode node = new ConditionNode(); long savedState = enableWait(node); LockSupport.setCurrentBlocker(this); // for back-compatibility ! boolean interrupted = false, rejected = false; while (!canReacquire(node)) { if (Thread.interrupted()) interrupted = true; else if ((node.status & COND) != 0) { try { + if (rejected) + node.block(); + else ForkJoinPool.managedBlock(node); + } catch (RejectedExecutionException ex) { + rejected = true; } catch (InterruptedException ie) { interrupted = true; } } else Thread.onSpinWait(); // awoke while enqueuing
*** 1234,1251 **** if (Thread.interrupted()) throw new InterruptedException(); ConditionNode node = new ConditionNode(); long savedState = enableWait(node); LockSupport.setCurrentBlocker(this); // for back-compatibility ! boolean interrupted = false, cancelled = false; while (!canReacquire(node)) { if (interrupted |= Thread.interrupted()) { if (cancelled = (node.getAndUnsetStatus(COND) & COND) != 0) break; // else interrupted after signal } else if ((node.status & COND) != 0) { try { ForkJoinPool.managedBlock(node); } catch (InterruptedException ie) { interrupted = true; } } else Thread.onSpinWait(); // awoke while enqueuing --- 1240,1262 ---- if (Thread.interrupted()) throw new InterruptedException(); ConditionNode node = new ConditionNode(); long savedState = enableWait(node); LockSupport.setCurrentBlocker(this); // for back-compatibility ! boolean interrupted = false, cancelled = false, rejected = false; while (!canReacquire(node)) { if (interrupted |= Thread.interrupted()) { if (cancelled = (node.getAndUnsetStatus(COND) & COND) != 0) break; // else interrupted after signal } else if ((node.status & COND) != 0) { try { + if (rejected) + node.block(); + else ForkJoinPool.managedBlock(node); + } catch (RejectedExecutionException ex) { + rejected = true; } catch (InterruptedException ie) { interrupted = true; } } else Thread.onSpinWait(); // awoke while enqueuing
< prev index next >