From acd6cf5b22bd5a994feb8e2f9d7896c6adbbe4d3 Mon Sep 17 00:00:00 2001 From: wolf Date: Thu, 24 Feb 2000 12:40:55 +0000 Subject: [PATCH] Small clean-up git-svn-id: https://svn.dealii.org/trunk@2489 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/base/source/multithread_info.cc | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/deal.II/base/source/multithread_info.cc b/deal.II/base/source/multithread_info.cc index 604279df43..7931d80141 100644 --- a/deal.II/base/source/multithread_info.cc +++ b/deal.II/base/source/multithread_info.cc @@ -11,18 +11,21 @@ // //---------------------------- multithread_info.cc ---------------- + #include #if defined(__linux__) - -#include -#include +# include +# include #endif #if defined(__sun__) -#include +# include #endif + + + #ifdef DEAL_II_USE_MT #if defined(__linux__) @@ -37,7 +40,7 @@ unsigned int MultithreadInfo::get_n_cpus() AssertThrow(cpuinfo,ExcProcNotPresent()); - while((cpuinfo)) + while(cpuinfo) { cpuinfo >> search; if (search.find("processor")!=string::npos) @@ -48,13 +51,16 @@ unsigned int MultithreadInfo::get_n_cpus() return nCPU; } + #elif defined(__sun__) + unsigned int MultithreadInfo::get_n_cpus() { return sysconf(_SC_NPROCESSORS_ONLN); } + #else #warning Detection of Processors not supported on this OS @@ -66,8 +72,8 @@ unsigned int MultithreadInfo::get_n_cpus() #endif - // not in multithreadmode -#else + +#else // not in multithreadmode unsigned int MultithreadInfo::get_n_cpus() { @@ -76,7 +82,6 @@ unsigned int MultithreadInfo::get_n_cpus() #endif -MultithreadInfo multithread_info; MultithreadInfo::MultithreadInfo () : n_cpus (get_n_cpus()), @@ -86,4 +91,6 @@ MultithreadInfo::MultithreadInfo () : +// definition of the variable which is declared `extern' in the .h file +MultithreadInfo multithread_info; -- 2.39.5