Esempio n. 1
0
        public static void Push(T newNode)
        {
            newNode.Clear();
            newNode.Next = null;
            var prevTail = Atomic.Swap(ref tail, newNode);

            prevTail.Next = newNode;
            return;
        }
Esempio n. 2
0
        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);
            }
        }
Esempio n. 3
0
 //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));
 }