i7处理器和windows8操作系统上的多线程问题

MultiThreading issue on i7 processor with windows8 os

本文关键字:多线程 问题 操作系统 处理器 windows8 i7      更新时间:2023-10-16

我运行的应用程序有两个线程。一个线程保存从相机抓取的图像,另一个线程处理这些图像,这里的问题是,处理线程在处理过程中停止(停滞或被阻止无法获取)几个小时后(每次运行时随机),但它在带有windows7的i3上以及在带有windowsXp的双核处理器上都能正常工作。两个线程中都没有关键节或锁。请帮我解决这个问题。

来自线程2:的代码

fn_Waitforfiles(); // while loop waits until the 4 images saved in watch folder if not it will return at count of 50
  CString strLog = "";
  strLog.Format("Entering Skipping..");
  for(int d = 1; d <= m_iInterLeave; d++)
  {
   m_ifileCount++;
   m_strcurFilePath.Format("%s\%lu.jpeg", m_strToProcessDir, m_ifileCount);
   if(PathFileExists(m_strcurFilePath))
    ::DeleteFile(m_strcurFilePath);
   else
   {
    m_ifileCount--;
    m_strcurFilePath.Format("%s\%lu.jpeg", m_strToProcessDir, m_ifileCount);
   }
   if(d == m_iInterLeave)
   {
    m_ifileCount++;
    m_strcurFilePath.Format("%s\%lu.jpeg", m_strToProcessDir, m_ifileCount);   
   }
  }
  strLog = "";
  strLog.Format("Skipped %d images on Interleaving..", m_iInterLeave);
  MSSLOGGER::WriteLog(_T(strLog));

在写入日志"Enter Skiping.."后,thread2不再运行

线索可能在"查看文件夹中的图像"中。这听起来像是你依赖于文件更改通知,而这些通知可能会被错过(更准确地说,其中一些通知可能会折叠成一个摘要通知)。