Lines Matching refs:slot

109      * The basic idea is to maintain a "slot", which is a reference to
112 * slot is null, it CAS'es (compareAndSets) a Node there and waits
114 * sees that the slot is non-null, and so CASes it back to null,
117 * fail because a slot at first appears non-null but is null upon
123 * deteriorates due to CAS contention on the single slot when
129 * fails to CAS in its chosen slot, it picks an alternative slot
131 * CASes into a slot but no other thread arrives, it tries
132 * another, heading toward the zero slot, which always exists even
136 * Waiting: Slot zero is special in that it is the only slot that
137 * exists when there is no contention. A thread occupying slot
140 * another slot. Waiting threads spin for a while (a period that
142 * before either blocking (if slot zero) or giving up (if other
147 * block and then unblock them. Non-slot-zero waits that elapse
168 * when a non-slot-zero wait elapses without being fulfilled.
176 * Hashing: Each thread picks its initial slot to use in accord
188 * Probing: On sensed contention of a selected slot, we probe
193 * and cache thrashing, we try the first selected slot twice
318 * The maximum slot index being used. The value sometimes
339 int index = hashIndex(); // Index of current slot
343 Object y; // Contents of current slot
344 Slot slot = arena[index];
345 if (slot == null) // Lazily initialize slots
347 else if ((y = slot.get()) != null && // Try to fulfill
348 slot.compareAndSet(y, null)) {
356 slot.compareAndSet(null, me)) {
357 if (index == 0) // Blocking wait for slot 0
359 awaitNanos(me, slot, nanos) :
360 await(me, slot);
361 Object v = spinWait(me, slot); // Spin wait for non-0
369 else if (++fails > 1) { // Allow 2 fails on 1st slot
372 index = m + 1; // Grow on 3rd failed slot
396 * from perfectly uniform slot probabilities when applied to all
416 * Creates a new slot at given index. Called only when the slot
421 * @param index the index to add slot at
424 // Create slot outside of lock to narrow sync region
435 * slot, if so, helping clear the node from its slot to avoid
439 * @param the slot it is waiting in
442 private static boolean tryCancel(Node node, Slot slot) {
445 if (slot.get() == node) // pre-check to minimize contention
446 slot.compareAndSet(node, null);
454 * Spin-waits for hole for a non-0 slot. Fails if spin elapses
461 private static Object spinWait(Node node, Slot slot) {
470 tryCancel(node, slot);
491 private static Object await(Node node, Slot slot) {
503 tryCancel(node, slot);
518 private Object awaitNanos(Node node, Slot slot, long nanos) {
538 tryCancel(node, slot);
542 else if (tryCancel(node, slot) && !w.isInterrupted())
549 * only upon return from timeout while waiting in slot 0. When a
552 * slot. So we scan to check for any. This is almost always
564 Slot slot = arena[j];
565 if (slot != null) {
566 while ((y = slot.get()) != null) {
567 if (slot.compareAndSet(y, null)) {