5#include "utils/DequeAllocator.h"
36 using container_type = std::deque<data_type, utils::DequeAllocator<data_type>>;
37 using registered_tasks_t = aithreadsafe::Wrapper<container_type, aithreadsafe::policy::Primitive<std::mutex>>;
40 mutable registered_tasks_t m_registered_tasks{utils::DequeAllocator<data_type>(m_nmr)};
41 std::atomic_bool m_triggered =
false;
43 void trigger(container_type
const& waiting_tasks)
const
45 for (
auto& p : waiting_tasks)
46 p.first->signal(p.second);
57 using std::memory_order;
58 if (m_triggered.load(memory_order::relaxed))
62 container_type* waiting_tasks;
63 bool need_trigger =
false;
65 registered_tasks_t::wat registered_tasks_w(m_registered_tasks);
66 registered_tasks_w->emplace_back(task, condition);
69 if (AI_UNLIKELY(m_triggered.load(memory_order::relaxed)))
71 waiting_tasks =
new container_type(utils::DequeAllocator<data_type>(m_nmr));
72 waiting_tasks->swap(*registered_tasks_w);
76 if (AI_UNLIKELY(need_trigger))
78 trigger(*waiting_tasks);
88 using std::memory_order;
90 ASSERT(!m_triggered.load(memory_order::relaxed));
91 m_triggered.store(
true, memory_order::relaxed);
93 container_type waiting_tasks(std::move(*registered_tasks_t::rat(m_registered_tasks)));
94 trigger(waiting_tasks);
Declaration of base class AIStatefulTask.
Declaration of class DefaultMemoryPagePool.
Definition: AIStatefulTask.h:96
uint32_t condition_type
The type of the skip_wait and idle bit masks.
Definition: AIStatefulTask.h:99
static utils::MemoryPagePool & instance()
Definition: DefaultMemoryPagePool.h:142
Definition: TaskEvent.h:33
bool signal(condition_type condition)
Definition: AIStatefulTask.cxx:1643
Tasks defined by the library project are put into this namespace.
Definition: AIStatefulTask.h:857