Beispiel #1
0
        public ReadOnlyCollection <IJob> PendingJobs(WorkUnit unit)
        {
            List <IJob> results = new List <IJob>();

            if (unit.GetType() == typeof(CPUWorkUnit))
            {
                foreach (CPUCore core in cores)
                {
                    if (core.WorkUnit == unit)
                    {
                        foreach (WorkerThread wt in core.WorkerThreads)
                        {
                            foreach (IJob job in wt.JobQueue)
                            {
                                results.Add(job);
                            }
                        }

                        break;
                    }
                }
            }

            /** FIXME: no code for other WU types yet **/

            return(new ReadOnlyCollection <IJob>(results));
        }
Beispiel #2
0
        public void Register(WorkUnit workUnit)
        {
            Type wuType = workUnit.GetType();

            if (!units.ContainsKey(wuType))
            {
                units[wuType] = new List <WorkUnit>();
            }

            units[wuType].Add(workUnit);
        }