#include <NvBlastTkEventQueue.h>
Public Member Functions | |
| template<class T > | |
| void | addEvent (T *payload) |
| void | addListener (TkEventListener &l) |
| template<typename T > | |
| T * | allocData () |
| void | dispatch (const Array< TkEvent >::type &events) const |
| void | dispatch () |
| operator const Array< TkEvent >::type & () | |
| void | protect (bool enable) |
| void | removeListener (TkEventListener &l) |
| void | reserveData (size_t size) |
| void | reserveEvents (uint32_t n) |
| void | reset () |
| TkEventQueue () | |
Typical usage:
| Nv::Blast::TkEventQueue::TkEventQueue | ( | ) | [inline] |
| void Nv::Blast::TkEventQueue::addEvent | ( | T * | payload | ) | [inline] |
Queue an event with a payload.
| void Nv::Blast::TkEventQueue::addListener | ( | TkEventListener & | l | ) | [inline] |
Add a listener to dispatch to.
| T* Nv::Blast::TkEventQueue::allocData | ( | ) | [inline] |
Request storage for payload.
Proxy function to dispatch events to this queue's listeners.
| void Nv::Blast::TkEventQueue::dispatch | ( | ) | [inline] |
Dispatch the stored events to the registered listeners. After dispatch, all data is invalidated.
Peek events queue for dispatch. Do not use in protected state.
| void Nv::Blast::TkEventQueue::protect | ( | bool | enable | ) | [inline] |
Debug help to catch (unwanted) allocations during task work. Note that this will not actually avoid allocations, but assert in debug builds.
Set true before using in distributed environment. Set false to return to single-thread mode.
| void Nv::Blast::TkEventQueue::removeListener | ( | TkEventListener & | l | ) | [inline] |
Remove a listener from dispatch list.
| void Nv::Blast::TkEventQueue::reserveData | ( | size_t | size | ) | [inline] |
Preallocate a memory block of size Bytes for payload data. Note that this will inevitably allocate a new memory block. Subsequent calls to allocData will use this memory piecewise.
| void Nv::Blast::TkEventQueue::reserveEvents | ( | uint32_t | n | ) | [inline] |
Preallocate space for events.
| void Nv::Blast::TkEventQueue::reset | ( | ) | [inline] |
Restores initial state. Data memory is currently not being reused. To be improved.