Easy way to execute an infinite loop in a separate thread until the object goes out of scope.
More...
#include <scopedparallelexecutor.h>
List of all members.
Detailed Description
Easy way to execute an infinite loop in a separate thread until the object goes out of scope.
This class executes an inifinte loop and calls the provided in every cycle. This all takes place in a separate thread. The processing is stopped gracefully and the thread joined when the instance of this class goes out of scope.
- Author:
- (c) 2009,2010 by Philipp Münzel
- Version:
- 1.3
Constructor & Destructor Documentation
SCS::ScopedParallelExecutor::ScopedParallelExecutor |
( |
boost::function< void()> |
run_function, |
|
|
long |
run_interval_ms |
|
) |
| |
- Parameters:
-
run_function | Function to be called in every loop cycle |
run_interval_ms | Sleep time between function calls in milliseconds |
SCS::ScopedParallelExecutor::~ScopedParallelExecutor |
( |
| ) |
|
Waits for next function call and breaks main loop after it, then joins the thread.
Member Function Documentation
static void SCS::ScopedParallelExecutor::delay |
( |
int |
seconds | ) |
[static] |
Platfrom-independant sleep function
- Parameters:
-
void SCS::ScopedParallelExecutor::setCallback |
( |
boost::function< void()> |
run_function | ) |
|
- Parameters:
-
run_function | Function to be called in every cycle. Replaces the old function. |
void SCS::ScopedParallelExecutor::setRunInterval |
( |
long |
milliseconds | ) |
|
- Parameters:
-
milliseconds | Sleep time between function calls in milliseconds |
The documentation for this class was generated from the following file: