Exemplo n.º 1
0
        /// <summary>
        /// Start function for the thread
        /// </summary>
        /// <param name="threadStartContext"></param>
        protected void ThreadProcessEngines(object threadStartContext)
        {
            try
            {
                this.State = SimulationThreadState.RUNNING;
                var context = (SimulationEngineThreadStart)threadStartContext;

                foreach (var simEngine in this.Engines)
                {
                    simEngine.UpdateWorld(context.Context, context.Step);
                }
            }
            catch (Exception ex)
            {
                Debug.WriteLine("Exception in SimulationThread {0}: {1}", this.Thread.ManagedThreadId, ex.Message);
            }
            finally
            {
                this.State = SimulationThreadState.NOT_RUNNING;
                if (this.ThreadCompleted != null)
                {
                    this.ThreadCompleted();
                }
            }
        }
Exemplo n.º 2
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="engines">The list of the engines to update</param>
 public SimulationThread(List <SimulationEngine> engines)
 {
     this.State   = SimulationThreadState.NOT_RUNNING;
     this.Engines = engines;
 }