Home
last modified time | relevance | path

Searched refs:lock (Results 1 – 25 of 114) 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 …]
/libcore/ojluni/src/main/java/java/util/concurrent/
DDelayQueue.java79 private final transient ReentrantLock lock = new ReentrantLock(); field in DelayQueue
105 private final Condition available = lock.newCondition();
143 final ReentrantLock lock = this.lock; in offer() local
144 lock.lock(); in offer()
153 lock.unlock(); in offer()
190 final ReentrantLock lock = this.lock; in poll() local
191 lock.lock(); in poll()
198 lock.unlock(); in poll()
210 final ReentrantLock lock = this.lock; in take() local
211 lock.lockInterruptibly(); in take()
[all …]
DLinkedBlockingDeque.java158 final ReentrantLock lock = new ReentrantLock(); field in LinkedBlockingDeque
161 private final Condition notEmpty = lock.newCondition();
164 private final Condition notFull = lock.newCondition();
197 final ReentrantLock lock = this.lock; in LinkedBlockingDeque() local
198 lock.lock(); // Never contended, but necessary for visibility in LinkedBlockingDeque()
207 lock.unlock(); in LinkedBlockingDeque()
344 final ReentrantLock lock = this.lock; in offerFirst() local
345 lock.lock(); in offerFirst()
349 lock.unlock(); in offerFirst()
359 final ReentrantLock lock = this.lock; in offerLast() local
[all …]
DArrayBlockingQueue.java114 final ReentrantLock lock; field in ArrayBlockingQueue
242 lock = new ReentrantLock(fair); in ArrayBlockingQueue()
243 notEmpty = lock.newCondition(); in ArrayBlockingQueue()
244 notFull = lock.newCondition(); in ArrayBlockingQueue()
267 final ReentrantLock lock = this.lock; in ArrayBlockingQueue() local
268 lock.lock(); // Lock only for visibility, not mutual exclusion in ArrayBlockingQueue()
280 lock.unlock(); in ArrayBlockingQueue()
310 final ReentrantLock lock = this.lock; in offer() local
311 lock.lock(); in offer()
320 lock.unlock(); in offer()
[all …]
DCyclicBarrier.java157 private final ReentrantLock lock = new ReentrantLock(); field in CyclicBarrier
159 private final Condition trip = lock.newCondition();
202 final ReentrantLock lock = this.lock; in dowait() local
203 lock.lock(); in dowait()
262 lock.unlock(); in dowait()
448 final ReentrantLock lock = this.lock; in isBroken() local
449 lock.lock(); in isBroken()
453 lock.unlock(); in isBroken()
467 final ReentrantLock lock = this.lock; in reset() local
468 lock.lock(); in reset()
[all …]
DPriorityBlockingQueue.java166 private final ReentrantLock lock; field in PriorityBlockingQueue
223 this.lock = new ReentrantLock(); in PriorityBlockingQueue()
224 this.notEmpty = lock.newCondition(); in PriorityBlockingQueue()
246 this.lock = new ReentrantLock(); in PriorityBlockingQueue()
247 this.notEmpty = lock.newCondition(); in PriorityBlockingQueue()
289 lock.unlock(); // must release and then re-acquire main lock in tryGrow()
311 lock.lock(); in tryGrow()
479 final ReentrantLock lock = this.lock; in offer() local
480 lock.lock(); in offer()
494 lock.unlock(); in offer()
[all …]
DScheduledThreadPoolExecutor.java878 private final ReentrantLock lock = new ReentrantLock(); field in ScheduledThreadPoolExecutor.DelayedWorkQueue
903 private final Condition available = lock.newCondition();
985 final ReentrantLock lock = this.lock; in contains() local
986 lock.lock(); in contains()
990 lock.unlock(); in contains()
995 final ReentrantLock lock = this.lock; in remove() local
996 lock.lock(); in remove()
1013 lock.unlock(); in remove()
1018 final ReentrantLock lock = this.lock; in size() local
1019 lock.lock(); in size()
[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/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/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/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/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()
DSupport_StringReader.java54 synchronized (lock) { in close()
82 synchronized (lock) { in mark()
119 synchronized (lock) { in read()
152 synchronized (lock) { in read()
187 synchronized (lock) { in ready()
206 synchronized (lock) { in reset()
229 synchronized (lock) { in skip()
/libcore/ojluni/src/main/java/java/io/
DWriter.java69 protected Object lock; field in Writer
76 this.lock = this; in Writer()
86 protected Writer(Object lock) { in Writer() argument
87 if (lock == null) { in Writer()
90 this.lock = lock; in Writer()
108 synchronized (lock) { in write()
181 synchronized (lock) { in write()
DReader.java60 protected Object lock; field in Reader
67 this.lock = this; in Reader()
76 protected Reader(Object lock) { in Reader() argument
77 if (lock == null) { in Reader()
80 this.lock = lock; in Reader()
180 synchronized (lock) { in skip()
DPrintWriter.java318 synchronized (lock) { in flush()
336 synchronized (lock) { in close()
403 synchronized (lock) { in write()
424 synchronized (lock) { in write()
454 synchronized (lock) { in write()
478 synchronized (lock) { in newLine()
640 synchronized (lock) { in println()
654 synchronized (lock) { in println()
668 synchronized (lock) { in println()
682 synchronized (lock) { in println()
[all …]
/libcore/ojluni/src/main/java/java/util/prefs/
DAbstractPreferences.java191 protected final Object lock = new Object(); field in AbstractPreferences
254 synchronized(lock) { in put()
288 synchronized(lock) { in get()
319 synchronized(lock) { in remove()
343 synchronized(lock) { in clear()
691 synchronized(lock) { in keys()
720 synchronized(lock) { in childrenNames()
758 synchronized(lock) { in parent()
812 synchronized(lock) { in node()
834 synchronized(lock) { in node()
[all …]

12345