void DoWork(object info) { MegaFlowTaskInfo inf = (MegaFlowTaskInfo)info; while (isRunning) { inf.pauseevent.WaitOne(Timeout.Infinite, false); RunSim(inf.start, inf.end); inf.end = 0; } }
void MakeThreads() { if (Cores > 0) { isRunning = true; tasks = new MegaFlowTaskInfo[Cores]; for (int i = 0; i < Cores; i++) { tasks[i] = new MegaFlowTaskInfo(); tasks[i].pauseevent = new AutoResetEvent(false); tasks[i]._thread = new Thread(DoWork); tasks[i]._thread.Start(tasks[i]); } } }
void MakeThreads() { if ( Cores > 0 ) { isRunning = true; tasks = new MegaFlowTaskInfo[Cores]; for ( int i = 0; i < Cores; i++ ) { tasks[i] = new MegaFlowTaskInfo(); tasks[i].pauseevent = new AutoResetEvent(false); tasks[i]._thread = new Thread(DoWork); tasks[i]._thread.Start(tasks[i]); } } }