[Insight-developers] MinGW and threads

Lorensen, William E (Research) lorensen at crd.ge.com
Thu Apr 28 13:25:24 EDT 2005


Sounds good to me.

	-----Original Message----- 
	From: insight-developers-bounces at itk.org on behalf of Bill Hoffman 
	Sent: Thu 4/28/2005 11:34 AM 
	To: insight-developers at itk.org 
	Cc: 
	Subject: [Insight-developers] MinGW and threads
	
	

	Hi,
	
	One of the new MinGW dashboards was failing a bunch of tests.
	By setting the max number of threads to 1 the tests started to pass.
	So, I think there is a problem with MinGW and threads.   To fix
	it I can do this:
	
	In itkMultiThreader.cxx:
	
	#if defined(_WIN32)
	    {
	  SYSTEM_INFO sysInfo;
	  GetSystemInfo(&sysInfo);
	  num = sysInfo.dwNumberOfProcessors;
	    }
	// force the number of threads to 1 for mingw since it is broken
	#if defined(__MINGW32__)
	   num = 1;
	#endif
	#endif
	
	
	On a related note, it would seem that the old SGI has a similar problem. 
	However, the fix is not done in itkMultiThreader.cxx but rather in
	itkTestMain.h:
	
	// On some sgi machines, threads and stl don't mix.
	#if defined(__sgi) && defined(_COMPILER_VERSION) && _COMPILER_VERSION <= 730
	   itk::MultiThreader::SetGlobalDefaultNumberOfThreads(1);
	#endif
	
	While this will make all the tests pass, if a user actually wrote an ITK application
	on that platform, it would use a greater number of threads and potentially not work.
	So, I propose changing itkMultiThreader.cxx to force the number of threads to 1 for
	the old SGI and MinGW.
	
	
	-Bill
	
	_______________________________________________
	Insight-developers mailing list
	Insight-developers at itk.org
	http://www.itk.org/mailman/listinfo/insight-developers
	



More information about the Insight-developers mailing list