17 #include "oneapi/tbb/task.h"
40 m_nodeCache{
new WaitNode[iInitialSize]},
41 m_nodeCacheSize{iInitialSize},
42 m_lastAssignedCacheIndex{0},
44 auto nodeCache = m_nodeCache.get();
45 for (
auto it = nodeCache, itEnd = nodeCache + m_nodeCacheSize; it != itEnd; ++it) {
46 it->m_fromCache =
true;
62 m_nodeCache = std::make_unique<WaitNode[]>(nSeenTasks);
64 for (
auto it = nodeCache, itEnd = nodeCache +
m_nodeCacheSize; it != itEnd; ++it) {
65 it->m_fromCache =
true;
82 returnValue->
m_task = iTask;
87 returnValue->
m_next.store(returnValue, std::memory_order_relaxed);
111 if (
nullptr == oldHead) {
132 iGroup->run([iTask]() {
150 if (
nullptr == oldHead) {
168 while (node == (next = node->
nextNode())) {
188 while (n == (next = n->
nextNode())) {
203 if (0 ==
t->decrement_ref_count()) {
oneapi::tbb::task_group * m_group
WaitNode * createNode(oneapi::tbb::task_group *iGroup, WaitingTask *iTask)
std::atomic< bool > m_waiting
std::atomic< unsigned int > m_lastAssignedCacheIndex
std::atomic< WaitNode * > m_head
void reset()
Resets access to the resource so that added tasks will wait.
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e g
std::atomic< WaitNode * > m_next
void dependentTaskFailed(std::exception_ptr iPtr)
Called if waited for task failed.
oneapi::tbb::task_group * group() const noexcept
void doneWaiting(std::exception_ptr iPtr)
Signals that the resource is now available and tasks should be spawned.
WaitingTask * release_no_decrement() noexcept
void doneWaiting(std::exception_ptr iExcept)
std::unique_ptr< WaitNode[]> m_nodeCache
std::exception_ptr m_exceptionPtr
void add(oneapi::tbb::task_group *, WaitingTask *)
Adds task to the waiting list.
WaitingTaskList(unsigned int iInitialSize=2)
Constructor.
unsigned int m_nodeCacheSize
void presetTaskAsFailed(std::exception_ptr iExcept)
WaitNode * nextNode() const
void setNextNode(WaitNode *iNext)
unsigned int decrement_ref_count()
void increment_ref_count()