public static void Push(T newNode) { newNode.Clear(); newNode.Next = null; var prevTail = Atomic.Swap(ref tail, newNode); prevTail.Next = newNode; return; }
internal void EnqueueInternal(MessageNodeBase newTail) { var oldTail = Atomic.Swap(ref tail, newTail); //if oldtail is null or tailing is failed if (!TryTail(oldTail, newTail)) { //statis is a single object in heap, no further allocation with object[] ThreadPool.QueueUserWorkItem(RunInternalWaitCallback, newTail); } }
//get next node and mark it as blocked //if it's not null, we dont need to execute exchange function static MessageNodeBase GetNext(MessageNodeBase prev) { return(Atomic.Swap(ref prev.Next, Blocked)); }