Beispiel #1
0
 /**
  * Stops all threads created by <I>all</I> <TT>CSPParallel</TT> and {@link ProcessManager} objects. No new threads can be
  * created until the <TT>resetDestroy</TT> method gets called.
  */
 public static void destroy()
 {
     lock (allParThreads)
     {
         if (!destroyCalled)
         {
             Console.WriteLine("*** jcsp.lang.CSPParallel: stopping " +
                               allParThreads.Count + " threads");
             //allParThreads.Size() + " threads");
             for (var i = allParThreads.GetEnumerator(); i.MoveNext();)
             {
                 /*final*/
                 ParThread t = i.Current.Value;
                 try
                 {
                     t.Interrupt();
                 }
                 catch (SecurityException e)
                 {
                     Console.WriteLine("*** jcsp.lang.CSPParallel: couldn't stop thread " +
                                       t + " - security exception");
                 }
             }
             destroyCalled = true;
         }
     }
 }
 /**
  * Interrupt the managed process.  This will usually cause the process to throw a
  * {@link ProcessInterruptedException}, which will likely halt the process.
  */
 public void interrupt()
 {
     thread.Interrupt();
 }