Access Violation in Asynchronous Agents Pipeline Application

已答覆 Access Violation in Asynchronous Agents Pipeline Application

  • 2012年1月29日 下午 11:04
     
      包含代碼

    i have an application use agent to implements simple image processing pipeline

    i have three agents

    1. Load Bitmap Agent and this its run function 
      void CLoadBitmapAgent::run()
      {
      	Bitmap *pSourceBitmap = new Bitmap(m_imagePath);
      	asend(m_target,pSourceBitmap);
      	done();
      }
      
    2. Convert to Gray Agent and this is its run function
      void CConvertToGrayAgent::run()
      {
      	BitmapUtilities bitmapUtilities;
      	Bitmap *pSourceBitmap = receive(m_source);
      	bitmapUtilities.ParallelConvertToGray(pSourceBitmap);
      	asend(m_target,pSourceBitmap);
      	done();
      
      }
    3. Save Bitmap Agent and also its run function as follow
      void CSaveBitmapAgent::run()
      {
      	Bitmap * bitmap = receive(m_source);
      	BitmapUtilities bitmapUtilities;
      	CLSID clsid; 
      	bitmapUtilities.GetEncoderClsid(L"image/jpeg",clsid);
      	bitmap->Save(L"D:\\final_image.jpg",&clsid);
      	done();
      }
      

      i get access violation exception and i don't know why
      i'm taking my first steps on parallel computing so i don't know how to solve it

      you can get app from this link
      https://skydrive.live.com/#cid=068215710BEF663D&id=68215710BEF663D!147
      ImageProcessingPipeline Application
      thanks so much

所有回覆

  • 2012年3月13日 下午 11:21
     
     已答覆

    Hi Ma7moud El-Naggar,

        the AV is because of incorrect params (count) to agent::wait_for_all function in image_processing_pipline_main.cpp. It needs to be the following:

    agent* agents[3] = {&loadBitmapAgent,&convertToGrayAgent,&saveBitmapAgent};

    agent::wait_for_all(3,agents);

    Thanks,

    Vinod.