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)

Additional Inherited Members

- Protected Member Functions inherited from frepple::utils::NonCopyable
 NonCopyable ()
 ~NonCopyable ()

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 3428 of file utils.h.


Member Typedef Documentation

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

Prototype of the thread function.

Definition at line 3432 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 3437 of file utils.h.

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

Constructor with a predefined number of worker threads.

Definition at line 3443 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 3449 of file utils.h.

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

Execute all functions and wait for them to finish.

Definition at line 245 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 3462 of file utils.h.

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

Updates the number of parallel workers that is activated.

Definition at line 3465 of file utils.h.


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