ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/jsr166/jsr166/src/main/java/util/concurrent/SynchronousQueue.java
(Generate patch)

Comparing jsr166/src/main/java/util/concurrent/SynchronousQueue.java (file contents):
Revision 1.56 by dl, Wed Aug 3 18:57:28 2005 UTC vs.
Revision 1.57 by jsr166, Thu Aug 18 18:34:54 2005 UTC

# Line 270 | Line 270 | public class SynchronousQueue<E> extends
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
# Line 284 | Line 284 | public class SynchronousQueue<E> extends
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              /*
# Line 364 | Line 364 | public class SynchronousQueue<E> extends
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
# Line 425 | Line 425 | public class SynchronousQueue<E> extends
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) {
# Line 434 | Line 434 | public class SynchronousQueue<E> extends
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
# Line 524 | Line 524 | public class SynchronousQueue<E> extends
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               */
# Line 555 | Line 555 | public class SynchronousQueue<E> extends
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) {
# Line 568 | Line 568 | public class SynchronousQueue<E> extends
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)
# Line 580 | Line 580 | public class SynchronousQueue<E> extends
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 &&
# Line 588 | Line 588 | public class SynchronousQueue<E> extends
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
# Line 676 | Line 676 | public class SynchronousQueue<E> extends
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
# Line 716 | Line 716 | public class SynchronousQueue<E> extends
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

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines