示例#1
0
            public event ResultEventHandler NewResultEvent;  // evento para enviar nuevos resultados


            public SpinDispatcher()
            {
                _DispatcherSharedMemory = new Dictionary <string, object>();
                _DispatcherThreads      = new Dictionary <string, SpinThread>();
                _Events = new Dictionary <string, AutoResetEvent>();
                Status  = SpinDispatcherStatus.Stopped;
            }
示例#2
0
 public virtual void Start()
 {
     Status = SpinDispatcherStatus.Starting;
     foreach (KeyValuePair <string, SpinThread> item in _DispatcherThreads)
     {
         item.Value.Start();
     }
     Status = SpinDispatcherStatus.Running;
 }
示例#3
0
 public virtual void Stop()
 {
     if (Status == SpinDispatcherStatus.Running || Status == SpinDispatcherStatus.Starting)
     {
         Status = SpinDispatcherStatus.Stopping;
         //recorro todos los hilos
         foreach (KeyValuePair <string, SpinThread> item in _DispatcherThreads)
         {
             item.Value.Stop();
             item.Value.Join();
         }
         Status = SpinDispatcherStatus.Stopped;
     }
 }