Beispiel #1
0
 public ThreadCodeObj(ThreadCode code, int interval)
 {
     CodeToCall = code;
     threadIntervals = interval;
 }
Beispiel #2
0
 public ThreadCodeObj(ThreadCode code,int interval,int affinity)
 {
     CodeToCall = code;
     threadIntervals = interval;
     processorAffinity = affinity;
 }
Beispiel #3
0
        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;
        }
Beispiel #4
0
 /// <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();
     }
 }
Beispiel #5
0
        /// <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)