Esempio n. 1
0
        //---------------------------------------------------------------------------
        //Main Process
        private void THREAD_PROCESS_0()
        {
            bool   bGo   = false;
            double Start = 0;
            double Scan  = 0;

            //
            try
            {
                while (m_bThreadRun[TH0])
                {
                    Thread.Sleep(1);

                    if (!bGo)
                    {
                        //-----------------------------------------------
                        Monitor.Enter(Obj);
                        try
                        {
                            m_bWatchDog[TH0] = false;

                            //Main Sequence
                            if (m_bIOOn)
                            {
                                SEQ.fn_Update();
                            }
                            //SEQ.fn_Update1();

                            m_bWatchDog[TH0] = true;
                        }
                        finally
                        {
                            Monitor.Exit(Obj);
                        }
                        //-----------------------------------------------



                        bGo = true;
                        m_tDelayTimer[TH0].Clear();
                    }

                    //if (Scan < THREAD_INTERVAL0)
                    //{
                    //    if (!m_tDelayTimer[TH0].OnDelay(bGo, THREAD_INTERVAL0 - Scan)) continue;
                    //}

                    bGo = false;

                    m_dScanTime[TH0] = TICK._GetTickTime() - Start;
                    Start            = TICK._GetTickTime();


                    //Scan Time Check
                    m_nScanTime [TH0] = (uint)Environment.TickCount - m_nStartTime[TH0];
                    m_nStartTime[TH0] = (uint)Environment.TickCount;
                }
            }
            catch (System.Exception ex)
            {
                m_bWatchDog[TH0] = false;

                System.Diagnostics.Trace.WriteLine(ex.Message);
                LOG.ExceptionTrace("[THREAD_PROCESS_0]", ex);
            }
        }