예제 #1
0
        public GameScheduler()
        {
            MaxAllowance = EngineSettings.OrganismSchedulingBlacklistOvertime;
            TicksPerSec  = 5;
            Quantum      = 5000;
            MaxOverage   = EngineSettings.OrganismSchedulingMaximumOvertime;
            _organisms   = new GameObjectCollection();
            _orgEnum     = _organisms.GetEnumerator();

            Debug.Assert(MaxOverage > Quantum);

            AppMgr.CurrentScheduler = this;

            // This handle is a psuedo handle that doesn't need to be closed
            _processHandle = GetCurrentProcess();

            // Create a thread other than the UI thread to run the animals on
            _activationThread = new Thread(ActivateBug)
            {
                Priority = ThreadPriority.AboveNormal
            };
            _activationThread.Start();

            // Wait for the ActivateBug routine to get far enough to
            // retreive its threadhandle which is needed to get accurate
            // timings on how much time the animal actually used on its thread.
            var success = _handleRetrieved.WaitOne();

            Debug.Assert(success);
        }
예제 #2
0
        public GameScheduler()
        {
            MaxAllowance = EngineSettings.OrganismSchedulingBlacklistOvertime;
            TicksPerSec = 5;
            Quantum = 5000;
            MaxOverage = EngineSettings.OrganismSchedulingMaximumOvertime;
            _organisms = new GameObjectCollection();
            _orgEnum = _organisms.GetEnumerator();

            Debug.Assert(MaxOverage > Quantum);

            AppMgr.CurrentScheduler = this;

            // This handle is a psuedo handle that doesn't need to be closed
            _processHandle = GetCurrentProcess();

            // Create a thread other than the UI thread to run the animals on
            _activationThread = new Thread(ActivateBug) {Priority = ThreadPriority.AboveNormal};
            _activationThread.Start();

            // Wait for the ActivateBug routine to get far enough to 
            // retreive its threadhandle which is needed to get accurate
            // timings on how much time the animal actually used on its thread.
            var success = _handleRetrieved.WaitOne();
            Debug.Assert(success);
        }
예제 #3
0
        public void CompleteOrganismDeserialization()
        {
            try
            {
                _organisms.CompleteOrganismDeserialization();
            }
            catch
            {
                _organisms = new GameObjectCollection();
                _orgEnum   = _organisms.GetEnumerator();

                throw;
            }
        }
예제 #4
0
        public void DeserializeOrganisms(Stream stream)
        {
            var b = new BinaryFormatter();

            try
            {
                _organisms = (GameObjectCollection)b.Deserialize(stream);
                _orgEnum   = _organisms.GetEnumerator();
            }
            catch
            {
                _organisms = new GameObjectCollection();
                _orgEnum   = _organisms.GetEnumerator();

                throw;
            }
        }
예제 #5
0
        public void DeserializeOrganisms(Stream stream)
        {
            var b = new BinaryFormatter();
            try
            {
                _organisms = (GameObjectCollection) b.Deserialize(stream);
                _orgEnum = _organisms.GetEnumerator();
            }
            catch
            {
                _organisms = new GameObjectCollection();
                _orgEnum = _organisms.GetEnumerator();

                throw;
            }
        }
예제 #6
0
        public void CompleteOrganismDeserialization()
        {
            try
            {
                _organisms.CompleteOrganismDeserialization();
            }
            catch
            {
                _organisms = new GameObjectCollection();
                _orgEnum = _organisms.GetEnumerator();

                throw;
            }
        }
예제 #7
0
        public GameScheduler()
        {
            _startTicks = DateTime.Now.Ticks;
            _organisms = new GameObjectCollection();
            _orgEnum = _organisms.GetEnumerator();

            Debug.Assert( _maxOverage > _quantum );

            AppMgr.CurrentScheduler = this;

            // This handle is a psuedo handle that doesn't need to be closed
            processHandle = GetCurrentProcess();

            // Create a thread other than the UI thread to run the animals on
            activationThread = new Thread(new ThreadStart(ActivateBug));
            activationThread.Priority = ThreadPriority.AboveNormal;
            activationThread.Start();

            // Wait for the ActivateBug routine to get far enough to
            // retreive its threadhandle which is needed to get accurate
            // timings on how much time the animal actually used on its thread.
            bool success = handleRetrieved.WaitOne();
            Debug.Assert(success);
        }