Searched defs:lock (Results 1 - 20 of 20) sorted by relevance

/libcore/luni/src/main/java/java/util/
H A DTimerTask.java29 final Object lock = new Object(); field in class:TimerTask
51 synchronized (lock) {
60 synchronized (lock) {
72 synchronized (lock) {
92 synchronized (lock) {
107 synchronized (lock) {
/libcore/luni/src/main/java/java/util/concurrent/locks/
H A DLock.java17 * <p>A lock is a tool for controlling access to a shared resource by
18 * multiple threads. Commonly, a lock provides exclusive access to a
19 * shared resource: only one thread at a time can acquire the lock and
20 * all access to the shared resource requires that the lock be
22 * a shared resource, such as the read lock of a {@link ReadWriteLock}.
25 * access to the implicit monitor lock associated with every object, but
26 * forces all lock acquisition and release to occur in a block-structured way:
38 * acquire the lock of node A, then node B, then release A and acquire
41 * allowing a lock to be acquired and released in different scopes,
52 * l.lock();
154 void lock(); method in interface:Lock
[all...]
H A DReentrantLock.java14 * behavior and semantics as the implicit monitor lock accessed using
20 * {@code lock} will return, successfully acquiring the lock, when
21 * the lock is not owned by another thread. The method will return
22 * immediately if the current thread already owns the lock. This can
29 * thread. Otherwise this lock does not guarantee any particular
36 * fair lock may obtain it multiple times in succession while other
38 * lock.
40 * honor the fairness setting. It will succeed if the lock
44 * follow a call to {@code lock} wit
97 abstract void lock(); method in class:ReentrantLock.Sync
181 final void lock() { method in class:ReentrantLock.NonfairSync
199 final void lock() { method in class:ReentrantLock.FairSync
260 public void lock() { method in class:ReentrantLock
[all...]
H A DReentrantReadWriteLock.java21 * ordering for lock access. However, it does support an optional
27 * to the read and write lock is unspecified, subject to reentrancy
28 * constraints. A nonfair lock that is continuously contended may
30 * will normally have higher throughput than a fair lock.
35 * approximately arrival-order policy. When the currently held lock
37 * be assigned the write lock, or if there is a group of reader threads
39 * assigned the read lock.
41 * <p>A thread that tries to acquire a fair read lock (non-reentrantly)
42 * will block if either the write lock is held, or there is a waiting
43 * writer thread. The thread will not acquire the read lock unti
687 ReadLock(ReentrantReadWriteLock lock) argument
701 public void lock() { method in class:ReentrantReadWriteLock.ReadLock
894 WriteLock(ReentrantReadWriteLock lock) argument
915 public void lock() { method in class:ReentrantReadWriteLock.WriteLock
[all...]
/libcore/luni/src/main/java/java/io/
H A DReader.java43 protected Object lock; field in class:Reader
50 lock = this;
54 * Constructs a new {@code Reader} with {@code lock} used to synchronize
57 * @param lock
60 * if {@code lock} is {@code null}.
62 protected Reader(Object lock) { argument
63 if (lock == null) {
66 this.lock = lock;
123 synchronized (lock) {
[all...]
H A DWriter.java41 protected Object lock; field in class:Writer
48 lock = this;
52 * Constructs a new {@code Writer} with {@code lock} used to synchronize
55 * @param lock
58 * if {@code lock} is {@code null}.
60 protected Writer(Object lock) { argument
61 if (lock == null) {
64 this.lock = lock;
125 synchronized (lock) {
[all...]
/libcore/luni/src/main/java/java/util/concurrent/
H A DCyclicBarrier.java108 * using the barrier - due to the non-deterministic way the lock
119 /** The lock for guarding barrier entry */
120 private final ReentrantLock lock = new ReentrantLock(); field in class:CyclicBarrier
122 private final Condition trip = lock.newCondition();
139 * Called only while holding lock.
151 * Called only while holding lock.
165 final ReentrantLock lock = this.lock;
166 lock.lock();
[all...]
H A DDelayQueue.java42 private transient final ReentrantLock lock = new ReentrantLock(); field in class:DelayQueue
68 private final Condition available = lock.newCondition();
106 final ReentrantLock lock = this.lock;
107 lock.lock();
116 lock.unlock();
153 final ReentrantLock lock = this.lock;
154 lock
[all...]
H A DArrayBlockingQueue.java74 /** Main lock guarding all access */
75 final ReentrantLock lock; field in class:ArrayBlockingQueue
121 * Call only when holding lock.
132 * Call only when holding lock.
147 * Call only when holding lock.
198 lock = new ReentrantLock(fair);
199 notEmpty = lock.newCondition();
200 notFull = lock.newCondition();
223 final ReentrantLock lock = this.lock;
[all...]
H A DLinkedBlockingDeque.java51 * single lock and using conditions to manage blocking.
125 /** Main lock guarding all access */
126 final ReentrantLock lock = new ReentrantLock(); field in class:LinkedBlockingDeque
129 private final Condition notEmpty = lock.newCondition();
132 private final Condition notFull = lock.newCondition();
165 final ReentrantLock lock = this.lock;
166 lock.lock(); // Never contended, but necessary for visibility
175 lock
[all...]
H A DPriorityBlockingQueue.java74 * operations protected with a single lock. However, allocation
76 * holding main lock) in order to allow takes to operate
79 * build-up. The need to back away from lock during allocation
81 * java.util.PriorityQueue operations within a lock, as was done
125 private final ReentrantLock lock; field in class:PriorityBlockingQueue
182 this.lock = new ReentrantLock();
183 this.notEmpty = lock.newCondition();
205 this.lock = new ReentrantLock();
206 this.notEmpty = lock.newCondition();
242 * holding lock
[all...]
H A DScheduledThreadPoolExecutor.java808 private final ReentrantLock lock = new ReentrantLock(); field in class:ScheduledThreadPoolExecutor.DelayedWorkQueue
833 private final Condition available = lock.newCondition();
845 * Call only when holding lock.
863 * Call only when holding lock.
884 * Resize the heap array. Call only when holding lock.
915 final ReentrantLock lock = this.lock;
916 lock.lock();
920 lock
[all...]
H A DThreadPoolExecutor.java248 * pauseLock.lock();
259 * pauseLock.lock();
268 * pauseLock.lock();
411 * to be generally preferable to use a lock. Among the reasons is
533 * to simplify acquiring and releasing a lock surrounding each
537 * non-reentrant mutual exclusion lock rather than use ReentrantLock
539 * lock when they invoke pool control methods like setCorePoolSize.
595 public void lock() { acquire(1); } method in class:ThreadPoolExecutor.Worker
644 mainLock.lock();
679 mainLock.lock();
[all...]
/libcore/luni/src/main/java/java/nio/channels/
H A DFileChannel.java55 * <li>lock ranges of bytes associated with the file,</li>
159 * Obtains an exclusive lock on this file.
161 * This is a convenience method for acquiring a maximum length lock on a
163 * {@code fileChannel.lock(0L, Long.MAX_VALUE, false);}
165 * @return the lock object representing the locked file area.
171 * either a lock is already held that overlaps this lock
172 * request, or another thread is waiting to acquire a lock that
176 * the lock.
179 * to acquire the lock
184 public final FileLock lock() throws IOException { method in class:FileChannel
250 public abstract FileLock lock(long position, long size, boolean shared) method in class:FileChannel
[all...]
/libcore/luni/src/test/java/libcore/java/lang/
H A DOldAndroidMonitorTest.java150 /* Before interrupting, grab the waiter lock, which
295 private static void deepWait(int depth, Object lock) { argument
296 synchronized (lock) {
298 deepWait(depth - 1, lock);
303 lock.wait();
313 Object lock; field in class:OldAndroidMonitorTest.Worker
316 Worker(int id, Object lock) { argument
319 this.lock = lock;
326 OldAndroidMonitorTest.deepWait(id, lock);
[all...]
/libcore/luni/src/main/java/java/net/
H A DDatagramSocket.java53 private Object lock = new Object(); field in class:DatagramSocket
488 synchronized (lock) {
/libcore/luni/src/main/java/java/nio/
H A DFileChannelImpl.java134 // FileChannel uses Long.MAX_VALUE to mean "lock the whole file" where POSIX uses 0.
160 public final FileLock lock(long position, long size, boolean shared) throws IOException { method in class:FileChannelImpl
182 * Non-API method to release a given lock on a file channel. Assumes that
183 * the lock will mark itself invalid after successful unlocking.
185 public void release(FileLock lock) throws IOException { argument
191 flock.l_start = lock.position();
192 flock.l_len = translateLockLength(lock.size());
199 removeLock(lock);
529 * Add a new pending lock to the manager. Throws an exception if the lock
533 addLock(FileLock lock) argument
552 removeLock(FileLock lock) argument
[all...]
/libcore/luni/src/main/java/java/util/logging/
H A DFileHandler.java132 // output file lock
133 FileLock lock = null; field in class:FileHandler
174 * if current process has held lock for this fileName continue
193 * if lock is unsupported and IOException thrown, just let the
197 lock = channel.tryLock();
198 if (lock == null) {
202 allLocks.put(fileName, lock);
492 FileChannel channel = lock.channel();
493 lock.release();
/libcore/luni/src/main/java/java/util/prefs/
H A DAbstractPreferences.java95 * The object used to lock this node.
97 protected final Object lock; field in class:AbstractPreferences
156 lock = new Object();
191 synchronized (lock) {
214 synchronized (lock) {
352 synchronized (lock) {
365 synchronized (lock) {
392 synchronized (lock) {
408 synchronized (lock) {
513 synchronized (lock) {
[all...]
/libcore/luni/src/main/native/
H A Dlibcore_io_Posix.cpp476 struct flock64 lock; local
477 memset(&lock, 0, sizeof(lock));
478 lock.l_type = env->GetShortField(javaFlock, typeFid);
479 lock.l_whence = env->GetShortField(javaFlock, whenceFid);
480 lock.l_start = env->GetLongField(javaFlock, startFid);
481 lock.l_len = env->GetLongField(javaFlock, lenFid);
482 lock.l_pid = env->GetIntField(javaFlock, pidFid);
485 int rc = throwIfMinusOne(env, "fcntl", TEMP_FAILURE_RETRY(fcntl(fd, cmd, &lock)));
487 env->SetShortField(javaFlock, typeFid, lock
[all...]

Completed in 359 milliseconds