code: private Node addWaiter(Node mode) {
          Node node = new Node(mode);
  
          for (;;) {
              Node oldTail = tail;
              if (oldTail != null) {
                  U.putObject(node, Node.PREV, oldTail);
                  if (compareAndSetTail(oldTail, node)) {
                      oldTail.next = node;
                      return node;
                  }
              } else {
                  initializeSyncQueue();
              }
          }
      }
docs: Creates and enqueues node for current thread and given mode.
  
  @param mode Node.EXCLUSIVE for exclusive, Node.SHARED for shared
  @return the new node