Example #1
0
        public void EndAll()
        {
            for (byte i = 0; i < ECG_COROUTINE_SCHEDULE_MAX; ++i)
            {
                PoolIndicies[EMCgCoroutineSchedule.Get()[i]] = 0;
            }

            for (byte i = 0; i < ECG_COROUTINE_SCHEDULE_MAX; ++i)
            {
                FECgCoroutineSchedule schedule = EMCgCoroutineSchedule.Get()[i];
                int count = RoutinesRunning[schedule].Count;

                for (int j = 0; j < count; ++j)
                {
                    RoutinesRunning[schedule][j].End(ECgCoroutineEndReason.Shutdown);
                    RoutinesRunning[schedule][j].Reset();
                }
            }

            for (byte i = 0; i < ECG_COROUTINE_SCHEDULE_MAX; ++i)
            {
                Heads[EMCgCoroutineSchedule.Get()[i]] = null;
            }

            for (byte i = 0; i < ECG_COROUTINE_SCHEDULE_MAX; ++i)
            {
                Tails[EMCgCoroutineSchedule.Get()[i]] = null;
            }

            for (ushort i = 0; i < POOL_SIZE; ++i)
            {
                Payloads[i].Reset();
            }
        }
Example #2
0
        public FCgCoroutineScheduler()
        {
            Pools = new Dictionary <FECgCoroutineSchedule, List <FCgRoutine> >(new FECgCoroutineScheduleEqualityComparer());

            for (byte i = 0; i < ECG_COROUTINE_SCHEDULE_MAX; ++i)
            {
                List <FCgRoutine>     routines = new List <FCgRoutine>();
                FECgCoroutineSchedule schedule = EMCgCoroutineSchedule.Get()[i];

                for (ushort j = 0; j < POOL_SIZE; ++j)
                {
                    routines.Add(new FCgRoutine(j, schedule, InsertRoutine));
                }
                Pools[EMCgCoroutineSchedule.Get()[i]] = routines;
            }

            PoolIndicies = new Dictionary <FECgCoroutineSchedule, int>(new FECgCoroutineScheduleEqualityComparer());

            for (byte i = 0; i < ECG_COROUTINE_SCHEDULE_MAX; ++i)
            {
                PoolIndicies[EMCgCoroutineSchedule.Get()[i]] = 0;
            }

            RoutinesRunning = new Dictionary <FECgCoroutineSchedule, List <FCgRoutine> >(new FECgCoroutineScheduleEqualityComparer());

            for (byte i = 0; i < ECG_COROUTINE_SCHEDULE_MAX; ++i)
            {
                RoutinesRunning[EMCgCoroutineSchedule.Get()[i]] = new List <FCgRoutine>();
            }

            Heads = new Dictionary <FECgCoroutineSchedule, FCgRoutine>(new FECgCoroutineScheduleEqualityComparer());

            for (byte i = 0; i < ECG_COROUTINE_SCHEDULE_MAX; ++i)
            {
                Heads[EMCgCoroutineSchedule.Get()[i]] = null;
            }

            Tails = new Dictionary <FECgCoroutineSchedule, FCgRoutine>(new FECgCoroutineScheduleEqualityComparer());

            for (byte i = 0; i < ECG_COROUTINE_SCHEDULE_MAX; ++i)
            {
                Tails[EMCgCoroutineSchedule.Get()[i]] = null;
            }

            Payloads = new List <FCgCoroutinePayload>();

            for (ushort i = 0; i < POOL_SIZE; ++i)
            {
                Payloads.Add(new FCgCoroutinePayload());
            }
        }
Example #3
0
 public void Reset()
 {
     bAllocated  = false;
     Schedule    = EMCgCoroutineSchedule.Get().GetMAX();
     StartTime   = 0.0f;
     Fiber       = null;
     Owner       = null;
     OwnerName   = "";
     RoutineType = FCgRoutine.INVALID_TYPE;
     Stop.Clear();
     Add    = null;
     Remove = null;
     Name   = "";
 }
Example #4
0
        // Constructor

        static FCgCoroutineScheduler()
        {
            ECG_COROUTINE_SCHEDULE_MAX = (byte)EMCgCoroutineSchedule.Get().Count;
        }