[Insight-developers] problems multithreading with WIN32

Miller, James V (Research) millerjv at crd . ge . com
Mon, 28 Jul 2003 14:14:55 -0400


I haven't seen it.  I was running 12 threads on a single processor Win2000
box
a few days ago to track down an iterator problem.



> -----Original Message-----
> From: Joshua Cates [mailto:cates at sci . utah . edu]
> Sent: Monday, July 28, 2003 2:07 PM
> To: Insight-Developers
> Subject: [Insight-developers] problems multithreading with WIN32
> 
> 
> Hi,
> 
> ITK multithreading fails with > 4 threads on my (single 
> processor) Windows
> NT machine with the Borland compiler.  Can anyone duplicate 
> this error?  
> Anyone seen it before?
> 
> 
> In itkMultiThreader.cxx line 287
> 
>   WaitForSingleObject(process_id[thread_loop], INFINITE);
> 
> never returns when thread_loop == 4 and m_NumberOfThreads == 5.
> 
> 
> For example, try the following code:
> 
> ITK_THREAD_RETURN_TYPE MultiThreadTest( void *ptr )
> {
>   int threadID = ( (itk::MultiThreader::ThreadInfoStruct 
> *)(ptr) )->ThreadID;
> 
>   std::cout << "test threadID = " << threadID << std::endl;
>   return ITK_THREAD_RETURN_VALUE;
> }
> 
> 
> int main(int, char **)
> {
>   try
>     {  
>     itk::MultiThreader::Pointer multithreader = 
> itk::MultiThreader::New();
>     multithreader->SetNumberOfThreads(5);
>     multithreader->SetSingleMethod( MultiThreadTest, 0);
>     multithreader->SingleMethodExecute();
>     }
>   catch (itk::ExceptionObject &e)
>     {
>     std::cerr << e << std::endl;
>     return 1;
>     }
>   return 0;
> }
> 
> 
> Josh.
> ______________________________
>  Josh Cates			
>  School of Computer Science	
>  University of Utah
>  Email: cates at sci . utah . edu
>  Phone: (801) 587-7697
>  URL:   http://www . sci . utah . edu/~cates
> 
> 
> _______________________________________________
> Insight-developers mailing list
> Insight-developers at itk . org
> http://www . itk . org/mailman/listinfo/insight-developers
>