[ VIGRA Homepage | Function Index | Class Index | Namespaces | File List | Main Page ]
ParallelOptions Class Reference |
Option base class for parallel algorithms. More...
#include <vigra/threadpool.hxx>
Public Types | |
enum | { Auto = -1, Nice = -2, NoThreads = 0 } |
Public Member Functions | |
int | getActualNumThreads () const |
Get desired number of threads. More... | |
int | getNumThreads () const |
Get desired number of threads. More... | |
ParallelOptions & | numThreads (const int n) |
Set the number of threads or one of the constants Auto , Nice and NoThreads . More... | |
Option base class for parallel algorithms.
#include <vigra/threadpool.hxx>
Namespace: vigra
anonymous enum |
int getNumThreads | ( | ) | const |
Get desired number of threads.
Note: This function may return 0, which means that multi-threading shall be switched off entirely. If an algorithm receives this value, it should revert to a sequential implementation. In contrast, if numThread() == 1
, the parallel algorithm version shall be executed with a single thread.
int getActualNumThreads | ( | ) | const |
Get desired number of threads.
In contrast to numThread()
, this will always return a value >=1
.
ParallelOptions& numThreads | ( | const int | n | ) |
Set the number of threads or one of the constants Auto
, Nice
and NoThreads
.
Default: ParallelOptions::Auto
(use system default)
This setting is ignored if the preprocessor flag VIGRA_SINGLE_THREADED
is defined. Then, the number of threads is set to 0 and all tasks revert to sequential algorithm implementations. The same can be achieved at runtime by passing n = 0
to this function. In contrast, passing n = 1
causes the parallel algorithm versions to be executed with a single thread. Both possibilities are mainly useful for debugging.
© Ullrich Köthe (ullrich.koethe@iwr.uni-heidelberg.de) |
html generated using doxygen and Python
|