< prev index next >

src/java.base/share/classes/java/util/concurrent/locks/AbstractQueuedLongSynchronizer.java

Print this page




  48  * This class has exactly the same structure, properties, and methods
  49  * as {@code AbstractQueuedSynchronizer} with the exception
  50  * that all state-related parameters and results are defined
  51  * as {@code long} rather than {@code int}. This class
  52  * may be useful when creating synchronizers such as
  53  * multilevel locks and barriers that require
  54  * 64 bits of state.
  55  *
  56  * <p>See {@link AbstractQueuedSynchronizer} for usage
  57  * notes and examples.
  58  *
  59  * @since 1.6
  60  * @author Doug Lea
  61  */
  62 public abstract class AbstractQueuedLongSynchronizer
  63     extends AbstractOwnableSynchronizer
  64     implements java.io.Serializable {
  65 
  66     private static final long serialVersionUID = 7373984972572414692L;
  67 





  68     /*
  69      * To keep sources in sync, the remainder of this source file is
  70      * exactly cloned from AbstractQueuedSynchronizer, replacing class
  71      * name and changing ints related with sync state to longs. Please
  72      * keep it that way.
  73      */
  74 
  75     // Node status bits, also used as argument and return values
  76     static final int WAITING   = 1;          // must be 1
  77     static final int CANCELLED = 0x80000000; // must be negative
  78     static final int COND      = 2;          // in a condition wait
  79 
  80     /** CLH Nodes */
  81     abstract static class Node {
  82         volatile Node prev;       // initially attached via casTail
  83         volatile Node next;       // visibly nonnull when signallable
  84         Thread waiter;            // visibly nonnull when enqueued
  85         volatile int status;      // written by owner, atomic bit ops by others
  86 
  87         // methods for atomic operations




  48  * This class has exactly the same structure, properties, and methods
  49  * as {@code AbstractQueuedSynchronizer} with the exception
  50  * that all state-related parameters and results are defined
  51  * as {@code long} rather than {@code int}. This class
  52  * may be useful when creating synchronizers such as
  53  * multilevel locks and barriers that require
  54  * 64 bits of state.
  55  *
  56  * <p>See {@link AbstractQueuedSynchronizer} for usage
  57  * notes and examples.
  58  *
  59  * @since 1.6
  60  * @author Doug Lea
  61  */
  62 public abstract class AbstractQueuedLongSynchronizer
  63     extends AbstractOwnableSynchronizer
  64     implements java.io.Serializable {
  65 
  66     private static final long serialVersionUID = 7373984972572414692L;
  67 
  68     /**
  69      * Constructor for subclasses to call.
  70      */
  71     public AbstractQueuedLongSynchronizer() {}
  72 
  73     /*
  74      * To keep sources in sync, the remainder of this source file is
  75      * exactly cloned from AbstractQueuedSynchronizer, replacing class
  76      * name and changing ints related with sync state to longs. Please
  77      * keep it that way.
  78      */
  79 
  80     // Node status bits, also used as argument and return values
  81     static final int WAITING   = 1;          // must be 1
  82     static final int CANCELLED = 0x80000000; // must be negative
  83     static final int COND      = 2;          // in a condition wait
  84 
  85     /** CLH Nodes */
  86     abstract static class Node {
  87         volatile Node prev;       // initially attached via casTail
  88         volatile Node next;       // visibly nonnull when signallable
  89         Thread waiter;            // visibly nonnull when enqueued
  90         volatile int status;      // written by owner, atomic bit ops by others
  91 
  92         // methods for atomic operations


< prev index next >