From: Daniel Arndt Date: Fri, 28 Sep 2018 21:13:12 +0000 (+0200) Subject: Fix compiling with THREADS=OFF X-Git-Tag: v9.1.0-rc1~668^2~2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0a2bdf2a305fa440981474b22bb2178abf31ae95;p=dealii.git Fix compiling with THREADS=OFF --- diff --git a/include/deal.II/base/thread_management.h b/include/deal.II/base/thread_management.h index 32050b2668..f07c62e24e 100644 --- a/include/deal.II/base/thread_management.h +++ b/include/deal.II/base/thread_management.h @@ -23,22 +23,17 @@ # include # include -# ifdef DEAL_II_WITH_THREADS -# include -# include -# include -# endif - +# include # include # include # include # include +# include # include # include # include - - # ifdef DEAL_II_WITH_THREADS +# include # ifdef DEAL_II_USE_MT_POSIX # include # endif diff --git a/source/base/thread_management.cc b/source/base/thread_management.cc index cb504a5247..aeb92f3745 100644 --- a/source/base/thread_management.cc +++ b/source/base/thread_management.cc @@ -148,19 +148,10 @@ namespace Threads -#ifndef DEAL_II_WITH_THREADS - DummyBarrier::DummyBarrier(const unsigned int count, const char *, void *) - { - (void)count; - Assert(count == 1, ExcBarrierSizeNotUseful(count)); - } - - -#else -# ifdef DEAL_II_USE_MT_POSIX +#ifdef DEAL_II_USE_MT_POSIX -# ifndef DEAL_II_USE_MT_POSIX_NO_BARRIERS +# ifndef DEAL_II_USE_MT_POSIX_NO_BARRIERS PosixThreadBarrier::PosixThreadBarrier(const unsigned int count, const char *, void *) @@ -168,7 +159,7 @@ namespace Threads pthread_barrier_init(&barrier, nullptr, count); } -# else +# else PosixThreadBarrier::PosixThreadBarrier(const unsigned int count, const char *, @@ -187,21 +178,21 @@ namespace Threads "this class, but the rest of the threading\n" "functionality is available.")); } -# endif +# endif PosixThreadBarrier::~PosixThreadBarrier() { -# ifndef DEAL_II_USE_MT_POSIX_NO_BARRIERS +# ifndef DEAL_II_USE_MT_POSIX_NO_BARRIERS pthread_barrier_destroy(&barrier); -# else +# else // unless the barrier is a no-op, // complain again (how did we get // here then?) if (count != 1) std::abort(); -# endif +# endif } @@ -209,9 +200,9 @@ namespace Threads int PosixThreadBarrier::wait() { -# ifndef DEAL_II_USE_MT_POSIX_NO_BARRIERS +# ifndef DEAL_II_USE_MT_POSIX_NO_BARRIERS return pthread_barrier_wait(&barrier); -# else +# else // in the special case, this // function is a no-op. otherwise // complain about the missing @@ -223,12 +214,11 @@ namespace Threads std::abort(); return 1; }; -# endif +# endif } -# endif #endif