Ejemplo n.º 1
0
        public void Terminate(string ID)
        {
            if (!TDSThreads.ContainsKey(ID))
            {
                return;
            }

            lock (this)
            {
                do
                {
                    while (TDSThreads[ID] != null && TDSThreads[ID].IsAlive)
                    {
                        TDSThreads[ID].Interrupt();
                        TDSThreads[ID].Abort();
                    }

                    TDSThreads[ID] = null;
                    bool removed = TDSThreads.Remove(ID);

                    if (!removed)
                    {
                    }
                } while (TDSThreads.ContainsKey(ID));
            }
        }
Ejemplo n.º 2
0
 public bool IsAlive(string ID)
 {//
     try
     {
         if (TDSThreads != null && !string.IsNullOrEmpty(ID) && TDSThreads.ContainsKey(ID) && TDSThreads[ID] != null && TDSThreads[ID].IsAlive)
         {
             return(true);
         }
         else
         {
             return(false);
         }
     }
     catch (Exception e)
     {
         return(false);
     }
 }
Ejemplo n.º 3
0
        public void Terminate(string ID)
        {
            if ((TDSThreads == null || !TDSThreads.ContainsKey(ID)) &&
                (TDSTMFlags == null || !TDSTMFlags.ContainsKey(ID)))
            {
                return;
            }

            if (TDSTMFlags.ContainsKey(ID))
            {
                TDSTMFlags[ID].IsAborting = true;
            }

            do
            {
                TDSThreads.GetValue(ID).KillInstantly();

                /*
                 * try
                 * {
                 *  if (TDSThreads.ContainsKey(ID) && TDSThreads[ID] != null && TDSThreads[ID].IsAlive)
                 *  {
                 *      TDSThreads[ID].Interrupt();
                 *      //TDSThreads[ID].Join(0);
                 *      TDSThreads[ID].Abort();
                 *  }
                 * }
                 * catch(Exception ex)
                 * {
                 *  Exceptions.Write(ex);
                 * }*/

                //TDSThreads.Update(ID, null);
                //TDSTMFlags.Update(ID, null);

                TDSThreads.Remove(ID);
                TDSTMFlags.Remove(ID);
                Thread.Sleep(1);
            } while (TDSThreads.ContainsKey(ID) || TDSTMFlags.ContainsKey(ID));
        }