# | Line 61 | Line 61 | public class AbstractQueuedSynchronizerT | |
---|---|---|
61 | } | |
62 | ||
63 | private final Sync sync = new Sync(); | |
64 | – | public void lock() { sync.acquireExclusiveUninterruptibly(1); } |
64 | public boolean tryLock() { | |
65 | return sync.acquireExclusiveState(false, 1, null) >= 0; | |
66 | } | |
67 | + | public void lock() { |
68 | + | if (!tryLock()) sync.acquireExclusiveUninterruptibly(1); |
69 | + | } |
70 | public void lockInterruptibly() throws InterruptedException { | |
71 | sync.acquireExclusiveInterruptibly(1); | |
72 | } |
– | Removed lines |
+ | Added lines |
< | Changed lines |
> | Changed lines |