Functions | Variables

cmtk::Threads Namespace Reference
[cmtkSystem Library]

Thread-related utility functions and global configuration variables. More...

Functions

void CheckEnvironment ()
 Check environment variables that control thread creation.
bool Available ()
 Check whether this system supports threads.
int GetNumberOfThreads ()
 Number of threads to run in parallel.
int SetNumberOfThreads (const int numberOfThreads=0, const bool force=false)
 Set the number of threads to run in parallel.
int GetMaxThreads ()
 Return number of threads allowed per process on this system.
int GetNumberOfProcessors ()
 Return number of processors currently online.
void RunThreads (ThreadFunction threadCall, const unsigned numberOfThreads, void *const parameters, const size_t parameterSize)
 Specialized but more hands-on thread scheduling function.
template<class T >
void RunThreads (ThreadFunction threadCall, const unsigned numberOfThreads, T *const parameters)
 Generic thread scheduling function.

Variables

int NumberOfThreads = 0
 (Maximum) number of threads to run in parallel.

Detailed Description

Thread-related utility functions and global configuration variables.


Function Documentation

template<class T >
void cmtk::Threads::RunThreads ( ThreadFunction  threadCall,
const unsigned  numberOfThreads,
T *const   parameters 
)

Generic thread scheduling function.

This function created a given number of parallel threads with user-provided thread-specific parameters. It then waits for all threads to complete before returning. This function is a convenience wrapper for the four-parameter function of the same name.

Parameters:
threadCallThread function to be called.
numberOfThreadsNumber of parallel threads. This parameter must not exceed the number of threads set using and returned by SetNumberOfThreads.
parametersPointer to an array of parameter blocks for all parallel threads. This is a template type parameter, so arbitrary parameter blocks can be used.

Definition at line 120 of file cmtkThreads.h.

References RunThreads().

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines