Exemplo n.º 1
0
        void EndDelaySuspend(CPUContext CPUContext)
        {
            if (CPUContext == null)
            {
                return;
            }

            if (!CPUContext.EndDelaySuspend())
            {
                CPUContext.Terminate();
            }
        }
Exemplo n.º 2
0
        public void ClearAllTask()
        {
            Task                Task;
            CPUContext          CPUContext;
            MemoryPool          MemPool;
            MemoryPoolFixedsize MemPoolFx;
            Mailbox             Mailbox;
            Semaphore           Semaphore;
            CyclicHandler       CyclicHandler;
            UdpCep              UdpCep;
            Udp6Cep             Udp6Cep;
            TcpCep              TcpCep;

            while (m_CyclicHandlerTable.Count != 0)
            {
                CyclicHandler = m_CyclicHandlerTable[0];
                m_CyclicHandlerTable.RemoveAt(0);
                //if(CyclicHandler != null)
                //	delete CyclicHandler;
            }

            do
            {
                LockTaskTable();
                try {
                    for (int i = 0; i < m_TaskTable.Count; i++)
                    {
                        Task       = m_TaskTable[i];
                        CPUContext = (CPUContext)(Task.GetCPUContext());
                        if ((CPUContext == null) || CPUContext.IsFinished())
                        {
                            m_TaskTable.RemoveAt(i);
                            i--;
                            continue;
                        }
                        try {
                            CPUContext.Terminate();
                        }
                        catch (System.Threading.ThreadAbortException) {
                        }
                        catch (Exception e) {
                            System.Diagnostics.Debug.WriteLine(e.Message);
                        }
                    }
                }
                finally {
                    UnlockTaskTable();
                }
                System.Threading.Thread.Yield();
            } while (m_TaskTable.Count != 0);

            while (m_MemPoolTable.Count != 0)
            {
                MemPool = m_MemPoolTable[0];
                MemPool.EnumMemoryBlock(this, EnumBlockCallBack);
                m_MemPoolTable.RemoveAt(0);
                //delete MemPool;
            }

            while (m_MemPoolFxTable.Count != 0)
            {
                MemPoolFx = m_MemPoolFxTable[0];
                m_MemPoolFxTable.RemoveAt(0);
                //delete MemPoolFx;
            }

            while (m_MailboxTable.Count != 0)
            {
                Mailbox = m_MailboxTable[0];
                m_MailboxTable.RemoveAt(0);
                //delete Mailbox;
            }

            while (m_SemaphoreTable.Count != 0)
            {
                Semaphore = m_SemaphoreTable[0];
                m_SemaphoreTable.RemoveAt(0);
                //delete Semaphore;
            }

            while (m_UdpCepTable.Count != 0)
            {
                UdpCep = m_UdpCepTable[0];
                m_UdpCepTable.RemoveAt(0);
                //delete UdpCep;
            }

            while (m_Udp6CepTable.Count != 0)
            {
                Udp6Cep = m_Udp6CepTable[0];
                m_Udp6CepTable.RemoveAt(0);
                //delete Udp6Cep;
            }

            while (m_TcpCepTable.Count != 0)
            {
                TcpCep = m_TcpCepTable[0];
                m_TcpCepTable.RemoveAt(0);
                //delete TcpCep;
            }
        }
Exemplo n.º 3
0
        void EndDelaySuspend(CPUContext CPUContext)
        {
            if (CPUContext == null)
                return;

            if (!CPUContext.EndDelaySuspend()) {
                CPUContext.Terminate();
            }
        }