Beispiel #1
0
        public bool ___removeHandle(Action value)
        {
            if (lastNode == null || maping == null)
            {
                return(false);
            }

            ActionNode <T> t = null;

            if (maping.TryGetValue(value, out t) == false || t.active == NodeActiveState.ToDoDelete)
            {
                return(false);
            }

            if (dispatching)
            {
                t.active = NodeActiveState.ToDoDelete;
                return(true);
            }

            return(_remove(t, value));
        }
Beispiel #2
0
        public void dispatch()
        {
            if (len > 0)
            {
                dispatching = true;
                ActionNode <T> t = firstNode;

                List <ActionNode <T> > temp = GetSignalNodeList();

                while (t != null)
                {
                    if (t.active == NodeActiveState.Runing)
                    {
                        t.action();
                    }
                    temp.Add(t);
                    t = t.next;
                }
                dispatching = false;

                int l = temp.Count;
                for (int i = 0; i < l; i++)
                {
                    ActionNode <T> item = temp[i];
                    if (item.active == NodeActiveState.ToDoDelete)
                    {
                        _remove(item, item.action);
                    }
                    else if (item.active == NodeActiveState.ToDoAdd)
                    {
                        item.active = NodeActiveState.Runing;
                    }
                }
                Recycle(temp);
            }
        }