예제 #1
0
        private static void process(object obj)
        {
            CFileSearchDetail fsd = obj as CFileSearchDetail;

            fsd.SearchInFile();
            fsd.m_OutQueue.Enqueue(fsd);
        }
예제 #2
0
        public void run()
        {
            string filePath;
            bool   bDequeueSuccesful = false;

            while (true)
            {
                bDequeueSuccesful = m_InQueue.TryDequeue(out filePath);
                if (!bDequeueSuccesful)
                {
                    m_FailedProcessCount++;
                    continue;
                }
                //如果是退出标志就退出
                if (filePath == "#$%EXIT%$#")
                {
                    while (m_SuccessProcessCount != CFullTextSearchDisplay.TotalRecvFileNum)
                    {
                        Thread.Sleep(50);
                    }
                    CFileSearchDetail fsd1 = new CFileSearchDetail(filePath);
                    fsd1.m_OutQueue.Enqueue(fsd1);
                    break;
                }
                m_SuccessProcessCount++;

                CFileSearchDetail fsd = new CFileSearchDetail(filePath);
                fsd.Pattern = m_Pattern;

                ThreadPool.QueueUserWorkItem(new WaitCallback(process), fsd);
            }
        }