Home
last modified time | relevance | path

Searched refs:lock (Results 1 – 25 of 120) sorted by relevance

12345

/libcore/jsr166-tests/src/test/java/jsr166/
DStampedLockTest.java34 final StampedLock lock; field in StampedLockTest.InterruptibleLockRunnable
35 InterruptibleLockRunnable(StampedLock l) { lock = l; } in InterruptibleLockRunnable()
37 lock.writeLockInterruptibly(); in realRun()
46 final StampedLock lock; field in StampedLockTest.InterruptedLockRunnable
47 InterruptedLockRunnable(StampedLock l) { lock = l; } in InterruptedLockRunnable()
49 lock.writeLockInterruptibly(); in realRun()
56 void releaseWriteLock(StampedLock lock, long s) { in releaseWriteLock() argument
57 assertTrue(lock.isWriteLocked()); in releaseWriteLock()
58 lock.unlockWrite(s); in releaseWriteLock()
59 assertFalse(lock.isWriteLocked()); in releaseWriteLock()
[all …]
DReentrantReadWriteLockTest.java41 final ReentrantReadWriteLock lock; field in ReentrantReadWriteLockTest.InterruptibleLockRunnable
42 InterruptibleLockRunnable(ReentrantReadWriteLock l) { lock = l; } in InterruptibleLockRunnable()
44 lock.writeLock().lockInterruptibly(); in realRun()
53 final ReentrantReadWriteLock lock; field in ReentrantReadWriteLockTest.InterruptedLockRunnable
54 InterruptedLockRunnable(ReentrantReadWriteLock l) { lock = l; } in InterruptedLockRunnable()
56 lock.writeLock().lockInterruptibly(); in realRun()
80 void releaseWriteLock(PublicReentrantReadWriteLock lock) { in releaseWriteLock() argument
81 ReentrantReadWriteLock.WriteLock writeLock = lock.writeLock(); in releaseWriteLock()
82 assertWriteLockedByMoi(lock); in releaseWriteLock()
83 assertEquals(1, lock.getWriteHoldCount()); in releaseWriteLock()
[all …]
DReentrantLockTest.java40 final ReentrantLock lock; field in ReentrantLockTest.InterruptibleLockRunnable
41 InterruptibleLockRunnable(ReentrantLock lock) { this.lock = lock; } in InterruptibleLockRunnable() argument
43 lock.lockInterruptibly(); in realRun()
52 final ReentrantLock lock; field in ReentrantLockTest.InterruptedLockRunnable
53 InterruptedLockRunnable(ReentrantLock lock) { this.lock = lock; } in InterruptedLockRunnable() argument
55 lock.lockInterruptibly(); in realRun()
79 void releaseLock(PublicReentrantLock lock) { in releaseLock() argument
80 assertLockedByMoi(lock); in releaseLock()
81 lock.unlock(); in releaseLock()
82 assertFalse(lock.isHeldByCurrentThread()); in releaseLock()
[all …]
DSemaphoreTest.java53 final Semaphore lock; field in SemaphoreTest.InterruptibleLockRunnable
54 InterruptibleLockRunnable(Semaphore s) { lock = s; } in InterruptibleLockRunnable()
57 lock.acquire(); in realRun()
67 final Semaphore lock; field in SemaphoreTest.InterruptedLockRunnable
68 InterruptedLockRunnable(Semaphore s) { lock = s; } in InterruptedLockRunnable()
70 lock.acquire(); in realRun()
324 final PublicSemaphore lock = new PublicSemaphore(1, fair); in testHasQueuedThreads() local
325 assertFalse(lock.hasQueuedThreads()); in testHasQueuedThreads()
326 lock.acquireUninterruptibly(); in testHasQueuedThreads()
327 Thread t1 = newStartedThread(new InterruptedLockRunnable(lock)); in testHasQueuedThreads()
[all …]
/libcore/ojluni/src/test/java/util/concurrent/tck/
DReentrantReadWriteLockTest.java64 final ReentrantReadWriteLock lock; field in ReentrantReadWriteLockTest.InterruptibleLockRunnable
65 InterruptibleLockRunnable(ReentrantReadWriteLock l) { lock = l; } in InterruptibleLockRunnable()
67 lock.writeLock().lockInterruptibly(); in realRun()
76 final ReentrantReadWriteLock lock; field in ReentrantReadWriteLockTest.InterruptedLockRunnable
77 InterruptedLockRunnable(ReentrantReadWriteLock l) { lock = l; } in InterruptedLockRunnable()
79 lock.writeLock().lockInterruptibly(); in realRun()
103 void releaseWriteLock(PublicReentrantReadWriteLock lock) { in releaseWriteLock() argument
104 ReentrantReadWriteLock.WriteLock writeLock = lock.writeLock(); in releaseWriteLock()
105 assertWriteLockedByMoi(lock); in releaseWriteLock()
106 assertEquals(1, lock.getWriteHoldCount()); in releaseWriteLock()
[all …]
DReentrantLockTest.java63 final ReentrantLock lock; field in ReentrantLockTest.InterruptibleLockRunnable
64 InterruptibleLockRunnable(ReentrantLock lock) { this.lock = lock; } in InterruptibleLockRunnable() argument
66 lock.lockInterruptibly(); in realRun()
75 final ReentrantLock lock; field in ReentrantLockTest.InterruptedLockRunnable
76 InterruptedLockRunnable(ReentrantLock lock) { this.lock = lock; } in InterruptedLockRunnable() argument
78 lock.lockInterruptibly(); in realRun()
102 void releaseLock(PublicReentrantLock lock) { in releaseLock() argument
103 assertLockedByMoi(lock); in releaseLock()
104 lock.unlock(); in releaseLock()
105 assertFalse(lock.isHeldByCurrentThread()); in releaseLock()
[all …]
DStampedLockTest.java64 void releaseWriteLock(StampedLock lock, long stamp) { in releaseWriteLock() argument
65 assertTrue(lock.isWriteLocked()); in releaseWriteLock()
66 assertValid(lock, stamp); in releaseWriteLock()
67 lock.unlockWrite(stamp); in releaseWriteLock()
68 assertFalse(lock.isWriteLocked()); in releaseWriteLock()
69 assertFalse(lock.validate(stamp)); in releaseWriteLock()
75 void releaseReadLock(StampedLock lock, long stamp) { in releaseReadLock() argument
76 assertTrue(lock.isReadLocked()); in releaseReadLock()
77 assertValid(lock, stamp); in releaseReadLock()
78 lock.unlockRead(stamp); in releaseReadLock()
[all …]
DSemaphoreTest.java76 final Semaphore lock; field in SemaphoreTest.InterruptibleLockRunnable
77 InterruptibleLockRunnable(Semaphore s) { lock = s; } in InterruptibleLockRunnable()
80 lock.acquire(); in realRun()
90 final Semaphore lock; field in SemaphoreTest.InterruptedLockRunnable
91 InterruptedLockRunnable(Semaphore s) { lock = s; } in InterruptedLockRunnable()
93 lock.acquire(); in realRun()
347 final PublicSemaphore lock = new PublicSemaphore(1, fair); in testHasQueuedThreads() local
348 assertFalse(lock.hasQueuedThreads()); in testHasQueuedThreads()
349 lock.acquireUninterruptibly(); in testHasQueuedThreads()
350 Thread t1 = newStartedThread(new InterruptedLockRunnable(lock)); in testHasQueuedThreads()
[all …]
/libcore/luni/src/test/java/libcore/java/util/concurrent/
DReentrantReadWriteLockTest.java35 final ReentrantReadWriteLock lock; field in ReentrantReadWriteLockTest.ReadLockRunnable
37 ReadLockRunnable(ReentrantReadWriteLock lock) { in ReadLockRunnable() argument
38 this.lock = lock; in ReadLockRunnable()
43 lock.readLock().lock(); in run()
44 lock.readLock().unlock(); in run()
49 final ReentrantReadWriteLock lock; field in ReentrantReadWriteLockTest.WriteLockRunnable
51 WriteLockRunnable(ReentrantReadWriteLock lock) { in WriteLockRunnable() argument
52 this.lock = lock; in WriteLockRunnable()
57 lock.writeLock().lock(); in run()
58 lock.writeLock().unlock(); in run()
[all …]
DStampedLockTest.java33 final StampedLock lock = new StampedLock(); in testIsLockStamp() local
35 long stamp = lock.tryConvertToReadLock(0L); in testIsLockStamp()
36 assertFalse(lock.isLockStamp(stamp)); in testIsLockStamp()
38 stamp = lock.tryOptimisticRead(); in testIsLockStamp()
39 stamp = lock.tryConvertToReadLock(stamp); in testIsLockStamp()
40 assertTrue(lock.isLockStamp(stamp)); in testIsLockStamp()
42 lock.unlockRead(stamp); in testIsLockStamp()
47 final StampedLock lock = new StampedLock(); in testIsOptimisticReadStamp() local
49 long stamp = lock.readLock(); in testIsOptimisticReadStamp()
50 assertFalse(lock.isOptimisticReadStamp(stamp)); in testIsOptimisticReadStamp()
[all …]
/libcore/ojluni/src/main/java/java/util/concurrent/
DDelayQueue.java80 private final transient ReentrantLock lock = new ReentrantLock(); field in DelayQueue
106 private final Condition available = lock.newCondition();
144 final ReentrantLock lock = this.lock; in offer() local
145 lock.lock(); in offer()
154 lock.unlock(); in offer()
191 final ReentrantLock lock = this.lock; in poll() local
192 lock.lock(); in poll()
199 lock.unlock(); in poll()
211 final ReentrantLock lock = this.lock; in take() local
212 lock.lockInterruptibly(); in take()
[all …]
DLinkedBlockingDeque.java159 final ReentrantLock lock = new ReentrantLock(); field in LinkedBlockingDeque
163 private final Condition notEmpty = lock.newCondition();
167 private final Condition notFull = lock.newCondition();
337 final ReentrantLock lock = this.lock; in offerFirst() local
338 lock.lock(); in offerFirst()
342 lock.unlock(); in offerFirst()
352 final ReentrantLock lock = this.lock; in offerLast() local
353 lock.lock(); in offerLast()
357 lock.unlock(); in offerLast()
368 final ReentrantLock lock = this.lock; in putFirst() local
[all …]
DCyclicBarrier.java159 private final ReentrantLock lock = new ReentrantLock(); field in CyclicBarrier
161 private final Condition trip = lock.newCondition();
204 final ReentrantLock lock = this.lock; in dowait() local
205 lock.lock(); in dowait()
263 lock.unlock(); in dowait()
449 final ReentrantLock lock = this.lock; in isBroken() local
450 lock.lock(); in isBroken()
454 lock.unlock(); in isBroken()
468 final ReentrantLock lock = this.lock; in reset() local
469 lock.lock(); in reset()
[all …]
DArrayBlockingQueue.java121 final ReentrantLock lock; field in ArrayBlockingQueue
274 lock = new ReentrantLock(fair); in ArrayBlockingQueue()
275 notEmpty = lock.newCondition(); in ArrayBlockingQueue()
276 notFull = lock.newCondition(); in ArrayBlockingQueue()
299 final ReentrantLock lock = this.lock; in ArrayBlockingQueue() local
300 lock.lock(); // Lock only for visibility, not mutual exclusion in ArrayBlockingQueue()
313 lock.unlock(); in ArrayBlockingQueue()
343 final ReentrantLock lock = this.lock; in offer() local
344 lock.lock(); in offer()
353 lock.unlock(); in offer()
[all …]
DPriorityBlockingQueue.java164 private final ReentrantLock lock = new ReentrantLock(); field in PriorityBlockingQueue
170 private final Condition notEmpty = lock.newCondition();
291 lock.unlock(); // must release and then re-acquire main lock in tryGrow()
308 lock.lock(); in tryGrow()
469 final ReentrantLock lock = this.lock; in offer() local
470 lock.lock(); in offer()
484 lock.unlock(); in offer()
523 final ReentrantLock lock = this.lock; in poll() local
524 lock.lock(); in poll()
528 lock.unlock(); in poll()
[all …]
DScheduledThreadPoolExecutor.java934 private final ReentrantLock lock = new ReentrantLock(); field in ScheduledThreadPoolExecutor.DelayedWorkQueue
959 private final Condition available = lock.newCondition();
1041 final ReentrantLock lock = this.lock; in contains() local
1042 lock.lock(); in contains()
1046 lock.unlock(); in contains()
1051 final ReentrantLock lock = this.lock; in remove() local
1052 lock.lock(); in remove()
1069 lock.unlock(); in remove()
1074 final ReentrantLock lock = this.lock; in size() local
1075 lock.lock(); in size()
[all …]
DSubmissionPublisher.java239 final ReentrantLock lock; field in SubmissionPublisher
280 this.lock = new ReentrantLock(); in SubmissionPublisher()
344 ReentrantLock lock = this.lock; in subscribe() local
351 lock.lock(); in subscribe()
388 lock.unlock(); in subscribe()
401 ReentrantLock lock = this.lock; in doOffer() local
402 lock.lock(); in doOffer()
435 lock.unlock(); in doOffer()
624 ReentrantLock lock = this.lock; in close() local
627 lock.lock(); in close()
[all …]
/libcore/harmony-tests/src/test/java/org/apache/harmony/tests/java/lang/
DObjectTest.java24 final Object lock = new Object(); field in ObjectTest
36 synchronized (lock) { in setUp()
43 synchronized (lock) { in tearDown()
119 synchronized (lock) { in test_notify()
122 lock.wait(); // Wait to be notified. in test_notify()
125 lock.wait(); in test_notify()
152 synchronized (lock) { in test_notify()
157 lock.wait(100, 0); in test_notify()
166 lock.notify(); in test_notify()
168 lock.wait(100); // Sleep for 100 msecs, releasing lock. in test_notify()
[all …]
/libcore/ojluni/src/main/java/java/net/
DInMemoryCookieStore.java69 private ReentrantLock lock = null; field in InMemoryCookieStore
83 lock = new ReentrantLock(false); in InMemoryCookieStore()
97 lock.lock(); in add()
105 lock.unlock(); in add()
125 lock.lock(); in get()
132 lock.unlock(); in get()
145 lock.lock(); in getCookies()
160 lock.unlock(); in getCookies()
195 lock.lock(); in getURIs()
201 lock.unlock(); in getURIs()
[all …]
/libcore/luni/src/test/java/libcore/java/lang/
DOldAndroidMonitorTest.java111 private final Object lock; field in OldAndroidMonitorTest.Waiter
115 public Waiter(Object lock, CountDownLatch cdl) { in Waiter() argument
116 this.lock = lock; in Waiter()
123 synchronized (lock) { in run()
127 lock.wait(); in run()
136 synchronized (lock) { in wasInterrupted()
143 final Object lock = new Object(); in testInterrupt() local
145 final Waiter waiter = new Waiter(lock, cdl); in testInterrupt()
158 synchronized (lock) { in testInterrupt()
/libcore/harmony-tests/src/test/java/org/apache/harmony/tests/java/nio/channels/
DFileChannelLockingTest.java89 readOnlyChannel.lock(); in test_illegalLocks()
97 writeOnlyChannel.lock(1, 10, true); in test_illegalLocks()
106 FileLock flock = readWriteChannel.lock(); in test_lockReadWrite()
115 readOnlyChannel.lock(-1, 10, true); in test_illegalLockParameters()
121 writeOnlyChannel.lock(-1, 10, false); in test_illegalLockParameters()
127 readWriteChannel.lock(-1, 10, false); in test_illegalLockParameters()
134 FileLock flock1 = readWriteChannel.lock(22, 110, true); in test_illegalLockParameters()
138 readWriteChannel.lock(75, 210, true); in test_illegalLockParameters()
147 FileLock flock1 = readWriteChannel.lock(0, 10, false); in test_lockLLZ()
150 FileLock flock2 = readWriteChannel.lock(22, 100, true); in test_lockLLZ()
[all …]
/libcore/luni/src/test/java/libcore/java/nio/channels/
DFileLockTest.java41 FileLock lock = fc.lock(0, 42, false); in testToString() local
42 String strLock = lock.toString(); in testToString()
49 lock.release(); in testToString()
50 strLock = lock.toString(); in testToString()
60 FileLock lock = fc.lock(0, 42, true); in testToString() local
61 String strLock = lock.toString(); in testToString()
68 lock.release(); in testToString()
69 strLock = lock.toString(); in testToString()
/libcore/support/src/test/java/tests/support/
DSupport_StringWriter.java34 lock = buf; in Support_StringWriter()
45 lock = buf; in Support_StringWriter()
79 synchronized (lock) { in getBuffer()
93 synchronized (lock) { in toString()
117 synchronized (lock) { in write()
136 synchronized (lock) { in write()
151 synchronized (lock) { in write()
174 synchronized (lock) { in write()
/libcore/ojluni/src/main/java/java/io/
DStringReader.java68 synchronized (lock) { in read()
90 synchronized (lock) { in read()
124 synchronized (lock) { in skip()
144 synchronized (lock) { in ready()
174 synchronized (lock) { in mark()
187 synchronized (lock) { in reset()
201 synchronized (lock) { in close()
DCharArrayReader.java104 synchronized (lock) { in read()
132 synchronized (lock) { in read()
158 synchronized (lock) { in read()
189 synchronized (lock) { in skip()
211 synchronized (lock) { in ready()
237 synchronized (lock) { in mark()
250 synchronized (lock) { in reset()
264 synchronized (lock) { in close()

12345