Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 56 for Unlock (0.36 sec)

  1. guava-tests/test/com/google/common/util/concurrent/CycleDetectingLockFactoryTest.java

        Lock lockA = factory.newReentrantReadWriteLock(OtherOrder.FIRST).readLock();
        Lock lockB = factory.newReentrantLock(OtherOrder.SECOND);
    
        lockA.lock();
        lockA.lock();
        lockB.lock();
        lockB.lock();
        lockA.unlock();
        lockA.unlock();
        lockB.unlock();
        lockB.unlock();
      }
    
    Java
    - Registered: Fri Apr 12 12:43:09 GMT 2024
    - Last Modified: Wed Sep 06 17:04:31 GMT 2023
    - 16.1K bytes
    - Viewed (0)
  2. android/guava-tests/test/com/google/common/util/concurrent/CycleDetectingLockFactoryTest.java

        Lock lockA = factory.newReentrantReadWriteLock(OtherOrder.FIRST).readLock();
        Lock lockB = factory.newReentrantLock(OtherOrder.SECOND);
    
        lockA.lock();
        lockA.lock();
        lockB.lock();
        lockB.lock();
        lockA.unlock();
        lockA.unlock();
        lockB.unlock();
        lockB.unlock();
      }
    
    Java
    - Registered: Fri Apr 19 12:43:09 GMT 2024
    - Last Modified: Wed Sep 06 17:04:31 GMT 2023
    - 16.1K bytes
    - Viewed (1)
  3. android/guava/src/com/google/common/util/concurrent/ForwardingLock.java

    import java.util.concurrent.locks.Condition;
    import java.util.concurrent.locks.Lock;
    
    /** Forwarding wrapper around a {@code Lock}. */
    @J2ktIncompatible
    @ElementTypesAreNonnullByDefault
    abstract class ForwardingLock implements Lock {
      abstract Lock delegate();
    
      @Override
      public void lock() {
        delegate().lock();
      }
    
      @Override
      public void lockInterruptibly() throws InterruptedException {
    Java
    - Registered: Fri Apr 19 12:43:09 GMT 2024
    - Last Modified: Tue Apr 04 09:45:04 GMT 2023
    - 1.5K bytes
    - Viewed (0)
  4. android/guava-tests/benchmark/com/google/common/util/concurrent/CycleDetectingLockFactoryBenchmark.java

      }
    
      @Benchmark
      void unorderedCycleDetectingLocks(int reps) {
        lockAndUnlock(factory.newReentrantLock("foo"), reps);
      }
    
      private static void lockAndUnlock(Lock lock, int reps) {
        for (int i = 0; i < reps; i++) {
          lock.lock();
          lock.unlock();
        }
      }
    
      @Benchmark
      void orderedPlainLocks(int reps) {
        lockAndUnlockNested(plainLocks, reps);
      }
    
      @Benchmark
    Java
    - Registered: Fri Apr 19 12:43:09 GMT 2024
    - Last Modified: Mon Dec 04 17:37:03 GMT 2017
    - 2.4K bytes
    - Viewed (0)
  5. guava-tests/test/com/google/common/util/concurrent/UninterruptiblesTest.java

          lock.lock();
          try {
            return condition.await(time, unit);
          } finally {
            lock.unlock();
          }
        }
    
        @Override
        public void awaitUninterruptibly() {
          lock.lock();
          try {
            condition.awaitUninterruptibly();
          } finally {
            lock.unlock();
          }
        }
    
        @Override
    Java
    - Registered: Fri Apr 12 12:43:09 GMT 2024
    - Last Modified: Wed Feb 09 22:57:07 GMT 2022
    - 31.7K bytes
    - Viewed (0)
  6. android/guava/src/com/google/common/util/concurrent/CycleDetectingLockFactory.java

     *
     * <ul>
     *   <li>for an unnested {@code lock()} and {@code unlock()}, a cycle detecting lock takes 38ns as
     *       opposed to the 24ns taken by a plain lock.
     *   <li>for nested locking, the cost increases with the depth of the nesting:
     *       <ul>
     *         <li>2 levels: average of 64ns per lock()/unlock()
     *         <li>3 levels: average of 77ns per lock()/unlock()
     *         <li>4 levels: average of 99ns per lock()/unlock()
    Java
    - Registered: Fri Apr 19 12:43:09 GMT 2024
    - Last Modified: Fri Dec 15 19:31:54 GMT 2023
    - 35.9K bytes
    - Viewed (0)
  7. android/guava/src/com/google/common/util/concurrent/AbstractScheduledService.java

             * holding a lock. Still, it would be nice to avoid somehow.
             */
            lock.lock();
            try {
              currentFuture.cancel(mayInterruptIfRunning);
            } finally {
              lock.unlock();
            }
          }
    
          @Override
          public boolean isCancelled() {
            lock.lock();
            try {
              return currentFuture.isCancelled();
    Java
    - Registered: Fri Apr 19 12:43:09 GMT 2024
    - Last Modified: Wed Dec 13 19:45:20 GMT 2023
    - 25.8K bytes
    - Viewed (0)
  8. guava-tests/benchmark/com/google/common/util/concurrent/CycleDetectingLockFactoryBenchmark.java

      }
    
      @Benchmark
      void unorderedCycleDetectingLocks(int reps) {
        lockAndUnlock(factory.newReentrantLock("foo"), reps);
      }
    
      private static void lockAndUnlock(Lock lock, int reps) {
        for (int i = 0; i < reps; i++) {
          lock.lock();
          lock.unlock();
        }
      }
    
      @Benchmark
      void orderedPlainLocks(int reps) {
        lockAndUnlockNested(plainLocks, reps);
      }
    
      @Benchmark
    Java
    - Registered: Fri Apr 19 12:43:09 GMT 2024
    - Last Modified: Mon Dec 04 17:37:03 GMT 2017
    - 2.4K bytes
    - Viewed (0)
  9. android/guava/src/com/google/common/util/concurrent/Monitor.java

        }
        final ReentrantLock lock = this.lock;
        lock.lock();
    
        boolean satisfied = false;
        try {
          return satisfied = guard.isSatisfied();
        } finally {
          if (!satisfied) {
            lock.unlock();
          }
        }
      }
    
      /**
       * Enters this monitor if the guard is satisfied. Blocks at most the given time acquiring the
       * lock, but does not wait for the guard to be satisfied.
    Java
    - Registered: Fri Apr 19 12:43:09 GMT 2024
    - Last Modified: Mon Dec 04 18:22:01 GMT 2023
    - 38.6K bytes
    - Viewed (0)
  10. guava/src/com/google/common/cache/LocalCache.java

          } finally {
            unlock();
            postWriteCleanup();
          }
        }
    
        // reference queues, for garbage collection cleanup
    
        /** Cleanup collected entries when the lock is available. */
        void tryDrainReferenceQueues() {
          if (tryLock()) {
            try {
              drainReferenceQueues();
            } finally {
              unlock();
            }
          }
        }
    Java
    - Registered: Fri Apr 05 12:43:09 GMT 2024
    - Last Modified: Thu Feb 22 17:40:56 GMT 2024
    - 150.3K bytes
    - Viewed (0)
Back to top