void DoWork(object info) { MegaCacheOBJTaskInfo inf = (MegaCacheOBJTaskInfo)info; while (isRunning) { inf.pauseevent.WaitOne(Timeout.Infinite, false); if (inf.end > 0) { PreLoad(inf.frame, inf.objcache); } inf.end = 0; // Done the job } }
void MakeThreads(MegaCacheOBJ cache) { if (Cores > 0) { isRunning = true; tasks = new MegaCacheOBJTaskInfo[Cores]; for (int i = 0; i < Cores; i++) { tasks[i] = new MegaCacheOBJTaskInfo(); tasks[i].objcache = cache; tasks[i].name = "ThreadID " + i; tasks[i].pauseevent = new AutoResetEvent(false); tasks[i]._thread = new Thread(DoWork); tasks[i]._thread.Start(tasks[i]); } } }
void MakeThreads(MegaCacheOBJ cache) { if ( Cores > 0 ) { isRunning = true; tasks = new MegaCacheOBJTaskInfo[Cores]; for ( int i = 0; i < Cores; i++ ) { tasks[i] = new MegaCacheOBJTaskInfo(); tasks[i].objcache = cache; tasks[i].name = "ThreadID " + i; tasks[i].pauseevent = new AutoResetEvent(false); tasks[i]._thread = new Thread(DoWork); tasks[i]._thread.Start(tasks[i]); } } }