#include <FunctionThread.h>

Classes | |
| struct | FunctorAndContext |
Public Member Functions | |
| FunctionThread () | |
| ~FunctionThread () | |
| void | StartThreads (int numThreads) |
| Starts the thread up. | |
| void | StopThreads (bool blockOnCurrentProcessing) |
| Stop processing. | |
| void | Push (Functor *functor, void *context=0) |
| Add a functor to the incoming stream of functors. | |
| void | CallResultHandlers (void) |
| Call FunctorResultHandler callbacks. | |
| void | CancelFunctorsWithContext (bool(*cancelThisFunctor)(FunctorAndContext func, void *userData), void *userData) |
| If you want to cancel input and output functors associated with some context, you can pass a function to do that here. | |
| void | SetPostResultFunction (void(*postResult)(FunctorAndContext func)) |
| If you want to automatically do some kind of processing on every functor after Functor::HandleResult is called, set it here. | |
Protected Member Functions | |
| void | CancelInput (void) |
Protected Attributes | |
| ThreadPool< FunctorAndContext, FunctorAndContext > | threadPool |
| void(* | pr )(FunctorAndContext func) |
FunctionThread takes a stream of classes that implement a processing function, processes them in a thread, and calls a callback with the result. It's a useful way to call blocking functions that you do not want to block, such as file writes and database operations.
Definition at line 25 of file FunctionThread.h.
| FunctionThread::FunctionThread | ( | ) |
Definition at line 21 of file FunctionThread.cpp.
| FunctionThread::~FunctionThread | ( | ) |
| void FunctionThread::CallResultHandlers | ( | void | ) |
Call FunctorResultHandler callbacks.
Normally you would call this once per update cycle, although you do not have to.
Definition at line 51 of file FunctionThread.cpp.


| void FunctionThread::CancelFunctorsWithContext | ( | bool(*)(FunctorAndContext func, void *userData) | cancelThisFunctor, | |
| void * | userData | |||
| ) |
If you want to cancel input and output functors associated with some context, you can pass a function to do that here.
| [in] | cancelThisFunctor | Function should return true to cancel the functor, false to let it process |
| [in] | userData | Pointer to whatever you want. Passed to the cancelThisFunctor call |
Definition at line 61 of file FunctionThread.cpp.

| void FunctionThread::CancelInput | ( | void | ) | [protected] |
Definition at line 82 of file FunctionThread.cpp.


| void FunctionThread::Push | ( | Functor * | functor, | |
| void * | context = 0 | |||
| ) |
Add a functor to the incoming stream of functors.
| [in] | functor | A pointer to an implemented Functor class |
| [in] | If | there is some context to this functor you want to look up to cancel it, you can set it here. Returned back to you in Functor::HandleResult |
Definition at line 44 of file FunctionThread.cpp.


| void FunctionThread::SetPostResultFunction | ( | void(*)(FunctorAndContext func) | postResult | ) |
If you want to automatically do some kind of processing on every functor after Functor::HandleResult is called, set it here.
Useful to cleanup FunctionThread::Push::context
| [in] | postResult | pointer to a C function to do post-processing |
Definition at line 78 of file FunctionThread.cpp.
| void FunctionThread::StartThreads | ( | int | numThreads | ) |
Starts the thread up.
Definition at line 29 of file FunctionThread.cpp.


| void FunctionThread::StopThreads | ( | bool | blockOnCurrentProcessing | ) |
Stop processing.
Will also call FunctorResultHandler callbacks with /a wasCancelled set to true.
| [in] | blockOnCurrentProcessing | Wait for the current processing to finish? |
Definition at line 33 of file FunctionThread.cpp.


void(* RakNet::FunctionThread::pr)(FunctorAndContext func) [protected] |
Definition at line 72 of file FunctionThread.h.
Definition at line 70 of file FunctionThread.h.
1.7.1