#include <FunctionThread.h>
Public Member Functions | |
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. |
void RakNet::FunctionThread::CallResultHandlers | ( | void | ) |
Call FunctorResultHandler callbacks.
Normally you would call this once per update cycle, although you do not have to.
void RakNet::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 |
void RakNet::FunctionThread::Push | ( | Functor * | functor, | |
void * | context = 0 | |||
) |
Add a functor to the incoming stream of functors.
For practical purposes this means the instance of functor you pass to this function has to be allocated using new and delete.
You should deallocate the pointer inside Functor::HandleResult()
[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 |
void RakNet::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 |
void RakNet::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? |