-
Notifications
You must be signed in to change notification settings - Fork 27
/
Copy pathBRAINSThreadControl.h
49 lines (43 loc) · 1.29 KB
/
BRAINSThreadControl.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#ifndef BRAINSThreadControl_h
#define BRAINSThreadControl_h
#include <itksys/SystemTools.hxx>
#include <sstream>
#include <itkMacro.h> // needed for ITK_VERSION_MAJOR
#if ITK_VERSION_MAJOR < 5
#include "itkMultiThreader.h"
#else
#include "itkMultiThreaderBase.h"
#endif
#include "ukf_exports.h"
namespace BRAINSUtils
{
/**
* This class is designed so that
* the ITK number of threads can be
* adjusted to a different number of threads
* during the running of this one call.
* The desired number of threads
* must be selected as part of the
* construction process, and at
* destruction, the original value is
* restored.
*
* This type of functionality is needed
* so that the shared libary version of
* BRAINSFit does not globally change
* the behavior of all other programs
* in slicer.
*/
class UKFBASELIB_EXPORTS StackPushITKDefaultNumberOfThreads
{
public:
explicit StackPushITKDefaultNumberOfThreads(const int desiredCount);
~StackPushITKDefaultNumberOfThreads();
protected:
StackPushITKDefaultNumberOfThreads(); // Purposefully not implemented
StackPushITKDefaultNumberOfThreads & operator=(StackPushITKDefaultNumberOfThreads &); // Purposefully not implemented
private:
int m_originalThreadValue;
};
}
#endif // BRAINSThreadControl_h