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; }
public virtual void Start() { Status = SpinDispatcherStatus.Starting; foreach (KeyValuePair <string, SpinThread> item in _DispatcherThreads) { item.Value.Start(); } Status = SpinDispatcherStatus.Running; }
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; } }