コード例 #1
0
        public static void QueueWorkItem(IComputation computation)
        {
            ISchedulableThread lowestWorkloadThread = null;

            lowestWorkloadThread = threadScheduler.GetScheduledThread();

            //If a thread is not started then do Start it.
            if (lowestWorkloadThread.IsStarted == false)
            {
                lowestWorkloadThread.Start();
            }

            //schedule a task.
            lowestWorkloadThread.Execute(computation);
            threadScheduler.Reschedule(lowestWorkloadThread, SchedulerAction.Enqueue);
        }
コード例 #2
0
        public static void QueueWorkItem(IComputation computation)
        {
            ISchedulableThread fiber = fiberScheduler.GetScheduledThread();

            if (!fiber.IsStarted)
            {
                fiber.Start();
            }

            //This code was commented out as upon fiber framework start we are creating
            //up front many fiber threads therefor it's pointless to exmpand even more
            //as it's hard to define a criteria how to expand.
            //
            //if (((FiberThread)fiber).ComputationCount >= nextFiberThreashold)
            //    fiberScheduler.Add(new FiberThread());

            fiber.Execute(computation);
        }