- public final boolean hasQueuedPredecessors() {
- // The correctness of this depends on head being initialized
- // before tail and on head.next being accurate if the current
- // thread is first in queue.Node t = tail;// Read fields in reverse initialization orderNode h = head;
- Node s;
- returnh != t &&
- ((s = h.next) ==null|| s.thread != Thread.currentThread());
- }
来源: http://www.cnblogs.com/sheeva/p/6478385.html