AutoPas  3.0.0
Loading...
Searching...
No Matches
NumThreadGuard.h
Go to the documentation of this file.
1
7#pragma once
8
10
14class NumThreadGuard final {
15 public:
20 explicit NumThreadGuard(const int newNum) : numThreadsBefore(autopas::autopas_get_max_threads()) {
22 }
23
28
32 NumThreadGuard(const NumThreadGuard &) = delete;
33
39
40 private:
41 int numThreadsBefore;
42};
NumThreadGuard sets current number of threads to newNum and resets number of threads during destructi...
Definition: NumThreadGuard.h:14
NumThreadGuard(const int newNum)
Construct a new NumThreadGuard object and sets current number of threads to newNum.
Definition: NumThreadGuard.h:20
NumThreadGuard(const NumThreadGuard &)=delete
delete copy constructor.
~NumThreadGuard()
Destroy the NumThreadGuard object and reset number of threads.
Definition: NumThreadGuard.h:27
NumThreadGuard & operator=(const NumThreadGuard &)=delete
delete copy assignment constructor.
This is the main namespace of AutoPas.
Definition: AutoPasDecl.h:32
void autopas_set_num_threads(int)
Wrapper for omp_set_num_threads().
Definition: WrapOpenMP.h:150