Ejemplo n.º 1
0
 internal string[] Next()
 {
     if (t == null)
     {
         threadDone = false;
         t          = new ThreadClass(Run);
         t.SetDaemon(true);
         t.Start();
     }
     string[] result;
     lock (this)
     {
         while (tuple == null && nmde == null && !threadDone && !stopped)
         {
             //try
             //{
             Monitor.Wait(this);
             //}
             //catch (ThreadInterruptedException ie)
             //{
             //    throw new ThreadInterruptedException(ie.ToString(), ie);
             //}
         }
         if (tuple != null)
         {
             result = tuple;
             tuple  = null;
             Monitor.Pulse(this);// notify();
             return(result);
         }
         if (nmde != null)
         {
             // Set to null so we will re-start thread in case
             // we are re-used:
             t = null;
             throw nmde;
         }
         // The thread has exited yet did not hit end of
         // data, so this means it hit an exception.  We
         // throw NoMorDataException here to force
         // benchmark to stop the current alg:
         throw new NoMoreDataException();
     }
 }