[Insight-developers] interrupting filter execution

Paul Koshevoy koshevoy at sci.utah.edu
Wed Jul 19 16:55:16 EDT 2006


Miller, James V (GE, Research) wrote:
> On a multiprocessor system, the DiscreteGaussian will 
> create multiple threads.  Any exceptions thrown in these threads
> should be caught by the Multithreader and passed to the main 
> thread (of the DiscreteGaussian).  
>
> I have to think about this.  I don't recall whether all threads
> of a filter check the abort execute and stop cleanly.  I have to 
> dig into the ProcessAccumulator to see.
>
> Jim
>   
I've cobbled together something that seems to work. I've modified
ProgressAccumulator::ReportProgress as follows:

void
ProgressAccumulator
::ReportProgress(Object *, const EventObject &event)
{
  static SimpleFastMutexLock mutex;
  {
    MutexLockHolder<SimpleFastMutexLock> mutexHolder(mutex);
    if (m_MiniPipelineFilter->GetAbortGenerateData())
    {
      m_MiniPipelineFilter->AbortGenerateDataOff();
     
      ProcessAborted e(__FILE__, __LINE__);
      e.SetDescription("ProgressAccumulator detected AbortGenerateData
flag");
      throw e;
    }
  }

....
}


After some debugging, it appeared to me that the exception was being
thrown multiple times (due to the multithreaded filter perhaps). My work
around has been to force the ProgressAccumulator to throw the exception
only once, as can be seen in the code above. I still don't understand
why neither of the multiply-thrown exceptions was being caught though.

    Paul.




More information about the Insight-developers mailing list