public ThreadCodeObj(ThreadCode code, int interval) { CodeToCall = code; threadIntervals = interval; }
public ThreadCodeObj(ThreadCode code,int interval,int affinity) { CodeToCall = code; threadIntervals = interval; processorAffinity = affinity; }
public int AddThread(ThreadCode threadCode, int threadInterval) #endif { int retVal = threads.Count; #if XBOX ThreadCodeObj thisThread = new ThreadCodeObj(threadCode, threadInterval,affinityIndex); #else ThreadCodeObj thisThread = new ThreadCodeObj(threadCode, threadInterval); #endif threadedCodeList.Add(threadedCodeList.Count, thisThread); threadStarters.Add(threadStarters.Count, new ThreadStart(thisThread.Worker)); threads.Add(threads.Count, new Thread(threadStarters[threads.Count])); threads[threads.Count - 1].Start(); return retVal; }
/// <summary> /// Method to start a thread /// </summary> /// <param name="threadCode"></param> /// <param name="threadInterval"></param> /// <param name="index"></param> public void StartThread(ThreadCode threadCode, int threadInterval, int index) { if (threadedCodeList[index].stopThread) { threads[index] = new Thread(threadStarters[index]); threadedCodeList[index].stopThread = false; threads[index].Start(); } }
/// <summary> /// Method to add a thread to the maanger. /// </summary> /// <param name="threadCode">Code to be executed in the thread.</param> /// <param name="threadInterval">Time period between each call in miliseconds</param> /// <returns>Index of thread, first one added will be 0 next 1 etc..</returns> #if XBOX public int AddThread(ThreadCode threadCode, int threadInterval,int affinityIndex)