# include <deal.II/base/multithread_info.h>
# include <deal.II/base/template_constraints.h>
-# ifdef DEAL_II_WITH_THREADS
-# include <condition_variable>
-# include <mutex>
-# include <thread>
-# endif
-
+# include <condition_variable>
# include <functional>
# include <iterator>
# include <list>
# include <memory>
+# include <mutex>
# include <tuple>
# include <utility>
# include <vector>
-
-
# ifdef DEAL_II_WITH_THREADS
+# include <thread>
# ifdef DEAL_II_USE_MT_POSIX
# include <pthread.h>
# endif
-#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 *)
pthread_barrier_init(&barrier, nullptr, count);
}
-# else
+# else
PosixThreadBarrier::PosixThreadBarrier(const unsigned int count,
const char *,
"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
}
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
std::abort();
return 1;
};
-# endif
+# endif
}
-# endif
#endif