示例#1
0
        private void thread_run()
        {
            while (!m_bStop)
            {
                m_oPauseEvent.WaitOne(Timeout.Infinite);
                if (File.Exists(m_sFileName) && LogReader.s_readPosition != new FileInfo(m_sFileName).Length)
                {
                    if (LogReader.s_readPosition > new FileInfo(m_sFileName).Length)
                    {
                        LogReader.reset();
                    }
                    LogReader logReader = null;
                    if (m_eDriverVersion == enumDriverVersion.CP5000)
                    {
                        logReader = new LogCPReader(m_sFileName, m_bTail);
                    }
                    else if (m_eDriverVersion == enumDriverVersion.MCD5x)
                    {
                        logReader = new LogMCDReader(m_sFileName, m_bTail);
                    }

                    Thread logThread = new Thread(new ParameterizedThreadStart(ThreadLogUpdate));
                    logThread.Name         = "LogReaderThread";
                    logThread.Priority     = ThreadPriority.Lowest;
                    logThread.IsBackground = true;
                    logThread.Start(logReader);
                    logThread.Join();
                }
                Thread.Sleep(100);
            }
        }
示例#2
0
        private void thread_run()
        {
            while (!m_bStop)
            {
                m_oPauseEvent.WaitOne(Timeout.Infinite);
                if (File.Exists(m_sFileName) && LogReader.s_readPosition != new FileInfo(m_sFileName).Length)
                {
                    if (LogReader.s_readPosition > new FileInfo(m_sFileName).Length)
                    {
                        LogReader.reset();
                    }
                    LogReader logReader = null;
                    if (m_eDriverVersion == enumDriverVersion.CP5000)
                    {
                        logReader = new LogCPReader(m_sFileName, m_bTail);
                    }
                    else if (m_eDriverVersion == enumDriverVersion.MCD5x)
                    {
                        logReader = new LogMCDReader(m_sFileName, m_bTail);
                    }

                    Thread logThread = new Thread(new ParameterizedThreadStart(ThreadLogUpdate));
                    logThread.Name = "LogReaderThread";
                    logThread.Priority = ThreadPriority.Lowest;
                    logThread.IsBackground = true;
                    logThread.Start(logReader);
                    logThread.Join();
                }
                Thread.Sleep(100);
            }
        }