Unbounded task queue.
More...
◆ Tasks
◆ Task_queue()
ddl::Loader::Task_queue::Task_queue |
( |
const Context & |
ctx, |
|
|
bool |
sync |
|
) |
| |
|
explicitnoexcept |
Constructor.
- Parameters
-
[in] | ctx | DDL context. |
[in] | sync | True for synchronous execution. |
◆ ~Task_queue()
ddl::Loader::Task_queue::~Task_queue |
( |
| ) |
|
|
noexcept |
◆ enqueue()
void ddl::Loader::Task_queue::enqueue |
( |
const Task & |
task | ) |
|
|
inlinenoexcept |
Enqueue a task to execute.
- Parameters
-
◆ execute()
dberr_t ddl::Loader::Task_queue::execute |
( |
| ) |
|
|
inline |
Dequeue and execute a task.
- Returns
- DB_SUCCESS or error code.
◆ mt_execute()
dberr_t ddl::Loader::Task_queue::mt_execute |
( |
| ) |
|
|
inlineprivate |
Execute function when there is more than one thread.
The general idea is as follows:
- Some initial tasks are added before threads come here to execute tasks.
- While executing, a task can generate more tasks. That is the only way a task can be added.
[1] & [2] implies that when all threads are idle, all tasks are completed and no more tasks can be added.
We exit here when all running threads are idle.
◆ signal()
void ddl::Loader::Task_queue::signal |
( |
| ) |
|
|
inlinenoexcept |
Wakeup the other threads e.g., on error.
◆ st_execute()
dberr_t ddl::Loader::Task_queue::st_execute |
( |
| ) |
|
|
inlineprivate |
Execute function when there is a single thread.
◆ thread_create_failed()
void ddl::Loader::Task_queue::thread_create_failed |
( |
| ) |
|
|
inlinenoexcept |
Note that we failed to create the configured number of threads.
◆ validate()
bool ddl::Loader::Task_queue::validate |
( |
| ) |
const |
|
inlinenoexcept |
- Returns
- true if number of tasks submitted == number of tasks executed.
◆ m_consumer_event
os_event_t ddl::Loader::Task_queue::m_consumer_event {} |
|
private |
Task queue consumer event.
◆ m_ctx
const Context& ddl::Loader::Task_queue::m_ctx |
|
private |
◆ m_mutex
ib_mutex_t ddl::Loader::Task_queue::m_mutex |
|
private |
Mutex protecting m_tasks access.
◆ m_n_idle
size_t ddl::Loader::Task_queue::m_n_idle {} |
|
private |
◆ m_n_tasks_executed
size_t ddl::Loader::Task_queue::m_n_tasks_executed {} |
|
private |
Number of tasks executed.
◆ m_n_tasks_submitted
size_t ddl::Loader::Task_queue::m_n_tasks_submitted {} |
|
private |
Number of tasks submitted.
◆ m_n_threads
size_t ddl::Loader::Task_queue::m_n_threads {} |
|
private |
Number of threads (including foreground thread).
◆ m_sync
bool ddl::Loader::Task_queue::m_sync {} |
|
private |
true if synchronous execution model.
◆ m_tasks
Tasks ddl::Loader::Task_queue::m_tasks {} |
|
private |
The documentation for this class was generated from the following file: