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,
53 * l.lock();
154 void lock(); method in interface:Lock
[all...]
H A DReentrantLock.java13 * behavior and semantics as the implicit monitor lock accessed using
19 * {@code lock} will return, successfully acquiring the lock, when
20 * the lock is not owned by another thread. The method will return
21 * immediately if the current thread already owns the lock. This can
28 * thread. Otherwise this lock does not guarantee any particular
35 * fair lock may obtain it multiple times in succession while other
37 * lock.
39 * honor the fairness setting. It will succeed if the lock
43 * follow a call to {@code lock} wit
95 abstract void lock(); method in class:ReentrantLock.Sync
179 final void lock() { method in class:ReentrantLock.NonfairSync
197 final void lock() { method in class:ReentrantLock.FairSync
258 public void lock() { method in class:ReentrantLock
[all...]
H A DReentrantReadWriteLock.java20 * ordering for lock access. However, it does support an optional
26 * to the read and write lock is unspecified, subject to reentrancy
27 * constraints. A nonfair lock that is continuously contended may
29 * will normally have higher throughput than a fair lock.
34 * approximately arrival-order policy. When the currently held lock
36 * be assigned the write lock, or if there is a group of reader threads
38 * assigned the read lock.
40 * <p>A thread that tries to acquire a fair read lock (non-reentrantly)
41 * will block if either the write lock is held, or there is a waiting
42 * writer thread. The thread will not acquire the read lock unti
688 ReadLock(ReentrantReadWriteLock lock) argument
702 public void lock() { method in class:ReentrantReadWriteLock.ReadLock
898 WriteLock(ReentrantReadWriteLock lock) argument
919 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) {
64 throw new NullPointerException("lock == null");
66 this.lock = 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) {
62 throw new NullPointerException("lock == null");
64 this.lock = lock;
[all...]
/libcore/luni/src/main/java/java/util/concurrent/
H A DCyclicBarrier.java110 * using the barrier - due to the non-deterministic way the lock
121 /** The lock for guarding barrier entry */
122 private final ReentrantLock lock = new ReentrantLock(); field in class:CyclicBarrier
124 private final Condition trip = lock.newCondition();
141 * Called only while holding lock.
153 * Called only while holding lock.
167 final ReentrantLock lock = this.lock;
168 lock.lock();
[all...]
H A DDelayQueue.java46 private transient final ReentrantLock lock = new ReentrantLock(); field in class:DelayQueue
72 private final Condition available = lock.newCondition();
110 final ReentrantLock lock = this.lock;
111 lock.lock();
120 lock.unlock();
157 final ReentrantLock lock = this.lock;
158 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 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 DArrayBlockingQueue.java79 /** Main lock guarding all access */
80 final ReentrantLock lock; field in class:ArrayBlockingQueue
131 * Call only when holding lock.
134 // assert lock.getHoldCount() == 1;
144 * Call only when holding lock.
147 // assert lock.getHoldCount() == 1;
163 * Call only when holding lock.
166 // assert lock.getHoldCount() == 1;
225 lock = new ReentrantLock(fair);
226 notEmpty = lock
[all...]
H A DScheduledThreadPoolExecutor.java809 private final ReentrantLock lock = new ReentrantLock(); field in class:ScheduledThreadPoolExecutor.DelayedWorkQueue
834 private final Condition available = lock.newCondition();
846 * Call only when holding lock.
864 * Call only when holding lock.
885 * Resize the heap array. Call only when holding lock.
916 final ReentrantLock lock = this.lock;
917 lock.lock();
921 lock
[all...]
H A DThreadPoolExecutor.java252 * pauseLock.lock();
263 * pauseLock.lock();
272 * pauseLock.lock();
415 * to be generally preferable to use a lock. Among the reasons is
537 * to simplify acquiring and releasing a lock surrounding each
541 * non-reentrant mutual exclusion lock rather than use ReentrantLock
543 * lock when they invoke pool control methods like setCorePoolSize.
599 public void lock() { acquire(1); } method in class:ThreadPoolExecutor.Worker
648 mainLock.lock();
683 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
485 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);
494 FileChannel channel = lock.channel();
495 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.cpp488 struct flock64 lock; local
489 memset(&lock, 0, sizeof(lock));
490 lock.l_type = env->GetShortField(javaFlock, typeFid);
491 lock.l_whence = env->GetShortField(javaFlock, whenceFid);
492 lock.l_start = env->GetLongField(javaFlock, startFid);
493 lock.l_len = env->GetLongField(javaFlock, lenFid);
494 lock.l_pid = env->GetIntField(javaFlock, pidFid);
497 int rc = throwIfMinusOne(env, "fcntl", TEMP_FAILURE_RETRY(fcntl(fd, cmd, &lock)));
499 env->SetShortField(javaFlock, typeFid, lock
[all...]

Completed in 424 milliseconds