frepple::utils::ThreadGroup Class Reference

This class supports parallel execution of a number of functions. More...

#include <utils.h>

Inheritance diagram for frepple::utils::ThreadGroup:

List of all members.

Public Types

typedef void(* callable )(void *)

Public Member Functions

void add (callable func, void *args)
void execute ()
int getMaxParallel () const
void setMaxParallel (int b)
 ThreadGroup ()
 ThreadGroup (int i)

Detailed Description

This class supports parallel execution of a number of functions.

Currently Pthreads and Windows threads are supported as the implementation of the multithreading.

Definition at line 3310 of file utils.h.


Member Typedef Documentation

typedef void(* frepple::utils::ThreadGroup::callable)(void *)

Prototype of the thread function.

Definition at line 3314 of file utils.h.


Constructor & Destructor Documentation

frepple::utils::ThreadGroup::ThreadGroup ( ) [inline]

Constructor which defaults to have as many worker threads as there are cores on the machine.

Definition at line 3319 of file utils.h.

frepple::utils::ThreadGroup::ThreadGroup ( int  i) [inline]

Constructor with a predefined number of worker threads.

Definition at line 3325 of file utils.h.


Member Function Documentation

void frepple::utils::ThreadGroup::add ( callable  func,
void *  args 
) [inline]

Add a new function to be called and its argument.

Definition at line 3331 of file utils.h.

void frepple::utils::ThreadGroup::execute ( )

Execute all functions and wait for them to finish.

Definition at line 252 of file utils/actions.cpp.

int frepple::utils::ThreadGroup::getMaxParallel ( ) const [inline]

Returns the number of parallel workers that is activated.
By default we activate as many worker threads as there are cores on the machine.

Definition at line 3344 of file utils.h.

void frepple::utils::ThreadGroup::setMaxParallel ( int  b) [inline]

Updates the number of parallel workers that is activated.

Definition at line 3347 of file utils.h.


The documentation for this class was generated from the following files:

Documentation generated for frePPLe by  doxygen