Beispiel #1
0
            public void OnDispose()
            {
                LoomThreadObject <T2> loomObj = Head as LoomThreadObject <T2>;

                loomObj.OnStop();
                while (loomObj.Next != null)
                {
                    loomObj = loomObj.Next as LoomThreadObject <T2>;
                    loomObj.OnStop();
                }
                currentNode = null;
            }
 /// <summary>
 /// 停止运行单个
 /// </summary>
 /// <param name="id"></param>
 /// <param name="callback"></param>
 public void StopOnThread(int id, T2 callback)
 {
     lock (lockObj)
     {
         LoomLinkList <T1, T2> linkList = null;
         if (_current.ContainsKey(id))
         {
             linkList = _current[id];
         }
         else if (_Actions.ContainsKey(id))
         {
             linkList = _Actions[id];
         }
         if (linkList == null)
         {
             return;
         }
         LoomThreadObject <T2> currentNode = linkList.Head as LoomThreadObject <T2>;
         while (currentNode != null)
         {
             if ((object)currentNode.callback == (object)callback)
             {
                 currentNode.OnStop();
                 break;
             }
             currentNode = currentNode.Next as LoomThreadObject <T2>;
         }
     }
 }