43 for (
auto it = nodeCache, itEnd = nodeCache +
m_nodeCacheSize; it != itEnd; ++it) {
44 it->m_fromCache =
true;
62 for (
auto it = nodeCache, itEnd = nodeCache +
m_nodeCacheSize; it != itEnd; ++it) {
63 it->m_fromCache =
true;
80 returnValue->
m_task = iTask;
84 returnValue->
m_next.store(returnValue, std::memory_order_relaxed);
90 iTask->increment_ref_count();
95 if (0 == iTask->decrement_ref_count()) {
96 tbb::task::spawn(*iTask);
111 if (
nullptr == oldHead) {
129 while (node == (next = node->
nextNode())) {
149 while (n == (next = n->
nextNode())) {
163 if (0 ==
t->decrement_ref_count()) {
164 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
void presetTaskAsFailed(std::exception_ptr iExcept)
WaitNode * nextNode() const
void setNextNode(WaitNode *iNext)
WaitNode * createNode(WaitingTask *iTask)