예제 #1
0
        // Instructs the ThreadPool class to run the given Jibu task with the given priority and
        // synchronizing on the provided barrier.
        internal static void runTask(ThreadDelegate task, ThreadPriority priority)
        {
            JibuThread thread = JibuThreadPool.getThread();

            thread.setPriority(priority);
            thread.Task = task;
            thread.runThread();
        }
예제 #2
0
 internal static void freeThreadandRelease(JibuThread t)
 {
     lock (typeof(JibuThreadPool))
     {
         if (busy.ContainsKey(t))
         {
             busy[t].Task = null;
             // used in PriParallel
             busy[t].setPriority(ThreadPriority.Normal);
             busy.Remove(t);
         }
     }
 }
예제 #3
0
        // Frees a JibuThread making it avaliable to new Jibu tasks.
        // If threadqueue with that stack size exists the free thread is added.
        // Otherwise the threadqueue is created and the free thread is added.
        internal static void freeThread(JibuThread t)
        {
            JibuThread temp;

            lock (typeof(JibuThreadPool))
            {
                temp = busy[t];
                freeThreads.Push(temp);

                temp.Task = null;
                temp.setPriority(ThreadPriority.Normal);
                busy.Remove(t);
            }
        }
예제 #4
0
 internal static JibuThread getThread()
 {
     lock (typeof(JibuThreadPool))
     {
         JibuThread temp;
         if (freeThreads.Count > 0)
         {
             temp = freeThreads.Pop();
         }
         else
         {
             temp = new JibuThread();
         }
         busy.Add(temp, temp);
         return(temp);
     }
 }
예제 #5
0
파일: ThreadPool.cs 프로젝트: vonwenm/Jibu
 internal static void freeThreadandRelease(JibuThread t)
 {
     lock (typeof(JibuThreadPool))
     {
         if (busy.ContainsKey(t))
         {
             busy[t].Task = null;
             // used in PriParallel
             busy[t].setPriority(ThreadPriority.Normal);
             busy.Remove(t);
         }             
     }
 }
예제 #6
0
파일: ThreadPool.cs 프로젝트: vonwenm/Jibu
        // Frees a JibuThread making it avaliable to new Jibu tasks.
        // If threadqueue with that stack size exists the free thread is added.
        // Otherwise the threadqueue is created and the free thread is added.
        internal static void freeThread(JibuThread t)
        {
            JibuThread temp;

            lock (typeof(JibuThreadPool))
            {
                temp = busy[t];
                freeThreads.Push(temp);

                temp.Task = null;
                temp.setPriority(ThreadPriority.Normal);
                busy.Remove(t);
            }
        }
예제 #7
0
파일: ThreadPool.cs 프로젝트: vonwenm/Jibu
 internal static JibuThread getThread()
 {
     lock (typeof(JibuThreadPool))
     {
         JibuThread temp;
         if (freeThreads.Count > 0)
             temp = freeThreads.Pop();
         else
         {
             temp = new JibuThread();
         }
         busy.Add(temp,temp);
         return temp;              
     }                
 }