Exemple #1
0
        public void Add(MicroThreadCallbackNode node)
        {
            if (First == null)
            {
                First = node;
            }
            else
            {
                Last.Next = node;
            }

            Last = node;
        }
Exemple #2
0
        public bool TakeFirst(out MicroThreadCallbackNode callback)
        {
            callback = First;

            if (First == null)
            {
                return(false);
            }

            First         = callback.Next;
            callback.Next = null;

            return(true);
        }
Exemple #3
0
        private MicroThreadCallbackNode NewCallback()
        {
            MicroThreadCallbackNode node;
            var pool = Scheduler.CallbackNodePool;

            if (Scheduler.CallbackNodePool.Count > 0)
            {
                var index = pool.Count - 1;
                node = pool[index];
                pool.RemoveAt(index);
            }
            else
            {
                node = new MicroThreadCallbackNode();
            }

            return(node);
        }