Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 10 for compareAndSet (0.12 sec)

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

          for (double x : VALUES) {
            assertBitEquals(prev, aa.get(i));
            assertFalse(aa.compareAndSet(i, unused, x));
            assertBitEquals(prev, aa.get(i));
            assertTrue(aa.compareAndSet(i, prev, x));
            assertBitEquals(x, aa.get(i));
            prev = x;
          }
        }
      }
    
      /** compareAndSet in one thread enables another waiting for value to succeed */
    Registered: Fri Nov 01 12:43:10 UTC 2024
    - Last Modified: Thu Oct 17 02:42:09 UTC 2024
    - 14.6K bytes
    - Viewed (0)
  2. guava-tests/test/com/google/common/util/concurrent/AtomicDoubleTest.java

          assertBitEquals(x, at.doubleValue());
        }
      }
    
      /** compareAndSet treats +0.0 and -0.0 as distinct values */
      public void testDistinctZeros() {
        AtomicDouble at = new AtomicDouble(+0.0);
        assertFalse(at.compareAndSet(-0.0, 7.0));
        assertFalse(at.weakCompareAndSet(-0.0, 7.0));
        assertBitEquals(+0.0, at.get());
        assertTrue(at.compareAndSet(+0.0, -0.0));
        assertBitEquals(-0.0, at.get());
    Registered: Fri Nov 01 12:43:10 UTC 2024
    - Last Modified: Thu Oct 17 02:42:09 UTC 2024
    - 10.3K bytes
    - Viewed (0)
  3. guava/src/com/google/common/util/concurrent/InterruptibleTask.java

         * interrupt, yet it will still run, since interruptTask will leave the runner value null,
         * allowing the CAS below to succeed.
         */
        Thread currentThread = Thread.currentThread();
        if (!compareAndSet(null, currentThread)) {
          return; // someone else has run or is running.
        }
    
        boolean run = !isDone();
        T result = null;
        Throwable error = null;
        try {
          if (run) {
    Registered: Fri Nov 01 12:43:10 UTC 2024
    - Last Modified: Thu Oct 17 02:42:09 UTC 2024
    - 10.1K bytes
    - Viewed (0)
  4. android/guava/src/com/google/common/util/concurrent/InterruptibleTask.java

         * interrupt, yet it will still run, since interruptTask will leave the runner value null,
         * allowing the CAS below to succeed.
         */
        Thread currentThread = Thread.currentThread();
        if (!compareAndSet(null, currentThread)) {
          return; // someone else has run or is running.
        }
    
        boolean run = !isDone();
        T result = null;
        Throwable error = null;
        try {
          if (run) {
    Registered: Fri Nov 01 12:43:10 UTC 2024
    - Last Modified: Thu Oct 17 02:42:09 UTC 2024
    - 10.1K bytes
    - Viewed (0)
  5. android/guava/src/com/google/common/collect/ConcurrentHashMultiset.java

       * AtomicInteger's atomic operations, with some help from ConcurrentMap's atomic operations on
       * creation and removal (including automatic removal of zeroes). If the modification of an
       * AtomicInteger results in zero, we compareAndSet the value to zero; if that succeeds, we remove
       * the entry from the Map. If another operation sees a zero in the map, it knows that the entry is
    Registered: Fri Nov 01 12:43:10 UTC 2024
    - Last Modified: Wed Oct 30 16:15:19 UTC 2024
    - 21.1K bytes
    - Viewed (0)
  6. guava-tests/test/com/google/common/util/concurrent/ExecutionListTest.java

        for (int i = 0; i < 10; i++) {
          final int expectedCount = i;
          list.add(
              new Runnable() {
                @Override
                public void run() {
                  integer.compareAndSet(expectedCount, expectedCount + 1);
                }
              },
              directExecutor());
        }
        list.execute();
        assertEquals(10, integer.get());
      }
    
    Registered: Fri Nov 01 12:43:10 UTC 2024
    - Last Modified: Fri Oct 18 22:10:29 UTC 2024
    - 4.7K bytes
    - Viewed (0)
  7. android/guava-tests/test/com/google/common/util/concurrent/ExecutionListTest.java

        for (int i = 0; i < 10; i++) {
          final int expectedCount = i;
          list.add(
              new Runnable() {
                @Override
                public void run() {
                  integer.compareAndSet(expectedCount, expectedCount + 1);
                }
              },
              directExecutor());
        }
        list.execute();
        assertEquals(10, integer.get());
      }
    
    Registered: Fri Nov 01 12:43:10 UTC 2024
    - Last Modified: Fri Oct 18 22:10:29 UTC 2024
    - 4.7K bytes
    - Viewed (0)
  8. guava-tests/test/com/google/common/util/concurrent/JSR166TestCase.java

       * test case failure. Only the first failure is recorded; subsequent calls to this method from
       * within the same test have no effect.
       */
      public void threadRecordFailure(Throwable t) {
        threadFailure.compareAndSet(null, t);
      }
    
      @Override
      public void setUp() {
        setDelays();
      }
    
      /**
       * Extra checks that get done for all test cases.
       *
    Registered: Fri Nov 01 12:43:10 UTC 2024
    - Last Modified: Thu Oct 17 02:42:09 UTC 2024
    - 37.9K bytes
    - Viewed (0)
  9. android/guava-tests/test/com/google/common/util/concurrent/JSR166TestCase.java

       * test case failure. Only the first failure is recorded; subsequent calls to this method from
       * within the same test have no effect.
       */
      public void threadRecordFailure(Throwable t) {
        threadFailure.compareAndSet(null, t);
      }
    
      @Override
      public void setUp() {
        setDelays();
      }
    
      /**
       * Extra checks that get done for all test cases.
       *
    Registered: Fri Nov 01 12:43:10 UTC 2024
    - Last Modified: Thu Oct 17 02:42:09 UTC 2024
    - 37.9K bytes
    - Viewed (0)
  10. android/guava/src/com/google/common/util/concurrent/ClosingFuture.java

            "Expected state to be %s, but it was %s",
            oldState,
            newState);
      }
    
      private boolean compareAndUpdateState(State oldState, State newState) {
        return state.compareAndSet(oldState, newState);
      }
    
      // TODO(dpb): Should we use a pair of ArrayLists instead of an IdentityHashMap?
      private static final class CloseableList extends IdentityHashMap<AutoCloseable, Executor>
    Registered: Fri Nov 01 12:43:10 UTC 2024
    - Last Modified: Tue Oct 08 19:36:35 UTC 2024
    - 98.5K bytes
    - Viewed (0)
Back to top