/libcore/luni/src/main/java/java/util/ |
H A D | TimerTask.java | 29 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 D | Lock.java | 17 * <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 D | ReentrantLock.java | 14 * 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 D | ReentrantReadWriteLock.java | 21 * 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 D | Reader.java | 43 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 D | Writer.java | 41 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 D | CyclicBarrier.java | 108 * 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 D | DelayQueue.java | 42 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 D | ArrayBlockingQueue.java | 74 /** 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 D | LinkedBlockingDeque.java | 51 * 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 D | PriorityBlockingQueue.java | 74 * 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 D | ScheduledThreadPoolExecutor.java | 808 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 D | ThreadPoolExecutor.java | 248 * 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 D | FileChannel.java | 55 * <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 D | OldAndroidMonitorTest.java | 150 /* 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 D | DatagramSocket.java | 53 private Object lock = new Object(); field in class:DatagramSocket 488 synchronized (lock) {
|
/libcore/luni/src/main/java/java/nio/ |
H A D | FileChannelImpl.java | 134 // 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 D | FileHandler.java | 132 // 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 D | AbstractPreferences.java | 95 * 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 D | libcore_io_Posix.cpp | 476 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...] |