270 |
|
} |
271 |
|
|
272 |
|
/** |
273 |
< |
* Create or reset fields of a node. Called only from transfer |
273 |
> |
* Creates or resets fields of a node. Called only from transfer |
274 |
|
* where the node to push on stack is lazily created and |
275 |
|
* reused when possible to help reduce intervals between reads |
276 |
|
* and CASes of head and to avoid surges of garbage when CASes |
284 |
|
} |
285 |
|
|
286 |
|
/** |
287 |
< |
* Put or take an item. |
287 |
> |
* Puts or takes an item. |
288 |
|
*/ |
289 |
|
Object transfer(Object e, boolean timed, long nanos) { |
290 |
|
/* |
364 |
|
} |
365 |
|
|
366 |
|
/** |
367 |
< |
* Spin/block until node s is matched by a fulfill operation. |
367 |
> |
* Spins/blocks until node s is matched by a fulfill operation. |
368 |
|
* @param s the waiting node |
369 |
|
* @param timed true if timed wait |
370 |
|
* @param nanos timeout value |
425 |
|
} |
426 |
|
|
427 |
|
/** |
428 |
< |
* Return true if node s is at head or there is an active |
428 |
> |
* Returns true if node s is at head or there is an active |
429 |
|
* fulfiller. |
430 |
|
*/ |
431 |
|
boolean shouldSpin(SNode s) { |
434 |
|
} |
435 |
|
|
436 |
|
/** |
437 |
< |
* Unlink s from the stack |
437 |
> |
* Unlinks s from the stack. |
438 |
|
*/ |
439 |
|
void clean(SNode s) { |
440 |
|
s.item = null; // forget item |
524 |
|
} |
525 |
|
|
526 |
|
/** |
527 |
< |
* Return true if this node is known to be off the queue |
527 |
> |
* Returns true if this node is known to be off the queue |
528 |
|
* because its next pointer has been forgotten due to |
529 |
|
* an advanceHead operation. |
530 |
|
*/ |
555 |
|
(TransferQueue.class, QNode.class, "head"); |
556 |
|
|
557 |
|
/** |
558 |
< |
* Try to cas nh as new head; if successful unlink |
558 |
> |
* Tries to cas nh as new head; if successful unlink |
559 |
|
* old head's next node to avoid garbage retention. |
560 |
|
*/ |
561 |
|
void advanceHead(QNode h, QNode nh) { |
568 |
|
(TransferQueue.class, QNode.class, "tail"); |
569 |
|
|
570 |
|
/** |
571 |
< |
* Try to cas nt as new tail. |
571 |
> |
* Tries to cas nt as new tail. |
572 |
|
*/ |
573 |
|
void advanceTail(QNode t, QNode nt) { |
574 |
|
if (tail == t) |
580 |
|
(TransferQueue.class, QNode.class, "cleanMe"); |
581 |
|
|
582 |
|
/** |
583 |
< |
* Try to CAS cleanMe slot |
583 |
> |
* Tries to CAS cleanMe slot. |
584 |
|
*/ |
585 |
|
boolean casCleanMe(QNode cmp, QNode val) { |
586 |
|
return (cleanMe == cmp && |
588 |
|
} |
589 |
|
|
590 |
|
/** |
591 |
< |
* Put or take an item. |
591 |
> |
* Puts or takes an item. |
592 |
|
*/ |
593 |
|
Object transfer(Object e, boolean timed, long nanos) { |
594 |
|
/* Basic algorithm is to loop trying to take either of |
676 |
|
} |
677 |
|
|
678 |
|
/** |
679 |
< |
* Spin/block until node s is fulfilled. |
679 |
> |
* Spins/blocks until node s is fulfilled. |
680 |
|
* @param s the waiting node |
681 |
|
* @param e the comparison value for checking match |
682 |
|
* @param timed true if timed wait |
716 |
|
} |
717 |
|
|
718 |
|
/** |
719 |
< |
* Get rid of cancelled node s with original predecessor pred. |
719 |
> |
* Gets rid of cancelled node s with original predecessor pred. |
720 |
|
*/ |
721 |
|
void clean(QNode pred, QNode s) { |
722 |
|
s.waiter = null; // forget thread |