]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
Take over 26990 from branch_cmake as well.
authorbangerth <bangerth@0785d39b-7218-0410-832d-ea1e28bc413d>
Sun, 14 Oct 2012 22:36:51 +0000 (22:36 +0000)
committerbangerth <bangerth@0785d39b-7218-0410-832d-ea1e28bc413d>
Sun, 14 Oct 2012 22:36:51 +0000 (22:36 +0000)
git-svn-id: https://svn.dealii.org/trunk@27125 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/source/base/logstream.cc
deal.II/source/base/thread_management.cc

index 312c3e03ca36886b7e36f6224e72198a70ab7844..9d6c83d3d649d64e24a684e2207d79c6a09ed08f 100644 (file)
 #include <sstream>
 
 
-// on SunOS 4.x, getrusage is stated in the man pages and exists, but
-// is not declared in resource.h. declare it ourselves
-#ifdef NO_HAVE_GETRUSAGE
-extern "C" {
-  int getrusage(int who, struct rusage* ru);
-}
-#endif
-
-// When modifying the prefix list, we need to lock it just in case
-// another thread tries to do the same.
 DEAL_II_NAMESPACE_OPEN
 
 namespace
@@ -63,7 +53,7 @@ LogStream::LogStream()
 {
   prefixes.push("DEAL:");
   std_out->setf(std::ios::showpoint | std::ios::left);
-#ifdef HAVE_TIMES
+#if defined(HAVE_UNISTD_H) && defined(HAVE_TIMES)
   reference_time_val = 1./sysconf(_SC_CLK_TCK) * times(&reference_tms);
 #endif
 }
@@ -371,7 +361,7 @@ LogStream::log_thread_id (const bool flag)
 void
 LogStream::print_line_head()
 {
-#ifndef DEAL_II_MSVC
+#ifdef HAVE_SYS_RESOURCE_H
   rusage usage;
   double utime = 0.;
   if (print_utime)
@@ -464,7 +454,7 @@ void
 LogStream::timestamp ()
 {
   struct tms current_tms;
-#ifdef HAVE_TIMES
+#if defined(HAVE_UNISTD_H) && defined(HAVE_TIMES)
   const clock_t tick = sysconf(_SC_CLK_TCK);
   const double time = 1./tick * times(&current_tms);
 #else
index 15891599f6e11dfbc549be9c5e44bba751577c29..fd83cf10fc2d322f0493ea4de7095cf8cf42c3b2 100644 (file)
 #include <iostream>
 #include <list>
 
+#ifdef HAVE_UNISTD_H
+#  include <unistd.h>
+#endif
+
 
 DEAL_II_NAMESPACE_OPEN
 
@@ -131,16 +135,13 @@ namespace Threads
   unsigned int this_thread_id ()
   {
 #ifdef SYS_gettid
-    const int this_id = syscall(SYS_gettid);
-#elif HAVE_GETPID
+    const pid_t this_id = syscall(SYS_gettid);
+#elif defined(HAVE_UNISTD_H) && defined(HAVE_GETPID)
     const pid_t this_id = getpid();
 #else
-#  ifdef DEAL_II_MSVC
     const unsigned int this_id = 0;
-#  else
-    const pid_t this_id = 0;
-#  endif
 #endif
+
     return static_cast<unsigned int>(this_id);
   }
 

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.