Searched defs:fair (Results 1 - 8 of 8) sorted by relevance

/openjdk7/jdk/test/java/util/concurrent/Semaphore/
H A DRacingReleases.java48 public static void test(final boolean fair, argument
52 final Semaphore sem = new Semaphore(0, fair);
106 if (sem.isFair() != fair)
112 for (boolean fair : new boolean[] { true, false })
114 test(fair, interruptibly);
/openjdk7/jdk/test/java/util/concurrent/SynchronousQueue/
H A DFairness.java34 private static void testFairness(boolean fair, argument
60 // Non-fair queues are lifo in our implementation
61 if (fair ? j != i : j != threadCount - 1 - i)
62 throw new Error(String.format("fair=%b i=%d j=%d%n",
63 fair, i, j));
/openjdk7/jdk/src/share/classes/java/util/concurrent/
H A DSemaphore.java140 * initialized as fair, to ensure that no thread is starved out from
142 * synchronization control, the throughput advantages of non-fair
168 * to represent permits. Subclassed into fair and nonfair
280 * @param fair {@code true} if this semaphore will guarantee
284 public Semaphore(int permits, boolean fair) { argument
285 sync = fair ? new FairSync(permits) : new NonfairSync(permits);
355 * fair ordering policy, a call to {@code tryAcquire()} <em>will</em>
515 * <p>Even when this semaphore has been set to use a fair ordering
H A DArrayBlockingQueue.java218 * @param fair if {@code true} then queue accesses for threads blocked
223 public ArrayBlockingQueue(int capacity, boolean fair) { argument
227 lock = new ReentrantLock(fair);
239 * @param fair if {@code true} then queue accesses for threads blocked
248 public ArrayBlockingQueue(int capacity, boolean fair, argument
250 this(capacity, fair);
H A DSynchronousQueue.java93 * The (Lifo) stack is used for non-fair mode, and the (Fifo)
94 * queue for fair mode. The performance of the two is generally
862 * @param fair if true, waiting threads contend in FIFO order for
865 public SynchronousQueue(boolean fair) { argument
866 transferer = fair ? new TransferQueue() : new TransferStack();
1160 boolean fair = transferer instanceof TransferQueue;
1161 if (fair) {
/openjdk7/jdk/test/java/util/concurrent/locks/ReentrantReadWriteLock/
H A DCount.java52 for (boolean fair : new boolean[] { true, false })
54 testReentrantLocks(fair, serialClone);
55 testConcurrentReadLocks(fair, serialClone);
59 void testConcurrentReadLocks(final boolean fair, argument
65 serialClone(new ReentrantReadWriteLock(fair)) :
66 new ReentrantReadWriteLock(fair);
98 void testReentrantLocks(final boolean fair, argument
101 serialClone(new ReentrantLock(fair)) :
102 new ReentrantLock(fair);
104 serialClone(new ReentrantReadWriteLock(fair))
[all...]
/openjdk7/jdk/src/share/classes/java/util/concurrent/locks/
H A DReentrantLock.java59 * access order. Programs using fair locks accessed by many threads
65 * fair lock may obtain it multiple times in succession while other
116 * into fair and nonfair versions below. Uses AQS state to
129 * Performs non-fair tryLock. tryAcquire is
201 * Sync object for non-fair locks
223 * Sync object for fair locks
269 * @param fair {@code true} if this lock should use a fair ordering policy
271 public ReentrantLock(boolean fair) { argument
272 sync = fair
[all...]
H A DReentrantReadWriteLock.java54 * <dt><b><i>Non-fair mode (default)</i></b>
55 * <dd>When constructed as non-fair (the default), the order of entry
59 * will normally have higher throughput than a fair lock.
63 * <dd> When constructed as fair, threads contend for entry using an
70 * <p>A thread that tries to acquire a fair read lock (non-reentrantly)
79 * <p>A thread that tries to acquire a fair write lock (non-reentrantly)
83 * do not honor this fair setting and will acquire the lock if it is
240 * @param fair {@code true} if this lock should use a fair ordering policy
242 public ReentrantReadWriteLock(boolean fair) { argument
[all...]

Completed in 319 milliseconds