37 m_nodeCache{
new WaitNode[iInitialSize]},
38 m_nodeCacheSize{iInitialSize},
39 m_lastAssignedCacheIndex{0},
42 auto nodeCache = m_nodeCache.get();
43 for(
auto it = nodeCache, itEnd = nodeCache+m_nodeCacheSize; it!=itEnd; ++it) {
64 for(
auto it = nodeCache, itEnd = nodeCache+
m_nodeCacheSize; it!=itEnd; ++it) {
84 returnValue->
m_task = iTask;
85 returnValue->
m_next = returnValue;
93 iTask->increment_ref_count();
98 if(0==iTask->decrement_ref_count()) {
99 tbb::task::spawn(*iTask);
112 if(
nullptr == oldHead) {
145 if(0==
t->decrement_ref_count()){
146 tbb::task::spawn(*
t);
std::atomic< bool > m_waiting
void add(WaitingTask *)
Adds task to the waiting list.
std::atomic< unsigned int > m_lastAssignedCacheIndex
std::atomic< WaitNode * > m_head
void reset()
Resets access to the resource so that added tasks will wait.
std::atomic< WaitNode * > m_next
void dependentTaskFailed(std::exception_ptr iPtr)
Called if waited for task failed.
void doneWaiting(std::exception_ptr iPtr)
Signals that the resource is now available and tasks should be spawned.
std::unique_ptr< WaitNode[]> m_nodeCache
std::exception_ptr m_exceptionPtr
WaitingTaskList(unsigned int iInitialSize=2)
Constructor.
unsigned int m_nodeCacheSize
WaitNode * nextNode() const
void setNextNode(WaitNode *iNext)
WaitNode * createNode(WaitingTask *iTask)