Fixed some bugs
This commit is contained in:
parent
d2154a8541
commit
616149d5dd
@ -513,4 +513,30 @@ void task_executor::executor(std::shared_ptr<executor_context> executor_context)
|
||||
task_context->notify.wait(task_lock);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void task_executor::print_statistics(const std::function<void(const std::string &)>& println, bool print_task_list) {
|
||||
println("Executor count: " + std::to_string(this->executors.size()));
|
||||
std::lock_guard task_lock{this->task_context->mutex};
|
||||
if(print_task_list) {
|
||||
println("Tasks (" + std::to_string(this->task_context->task_count) + "):");
|
||||
{
|
||||
auto head = this->task_context->task_head;
|
||||
while(head) {
|
||||
println(" - " + head->name);
|
||||
head = head->next;
|
||||
}
|
||||
}
|
||||
println("Recurring task count (" + std::to_string(this->task_context->task_recurring_count) + "):");
|
||||
{
|
||||
auto head = this->task_context->task_recurring_head;
|
||||
while(head) {
|
||||
println(" - " + head->name);
|
||||
head = head->next;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
println("Task count: " + std::to_string(this->task_context->task_count));
|
||||
println("Recurring task count: " + std::to_string(this->task_context->task_recurring_count));
|
||||
}
|
||||
}
|
@ -51,6 +51,8 @@ namespace ts {
|
||||
std::string /* name */,
|
||||
std::chrono::nanoseconds /* interval */,
|
||||
std::function<void(const std::chrono::system_clock::time_point& /* last scheduled */)> /* callback */);
|
||||
|
||||
void print_statistics(const std::function<void(const std::string &)>& /* print function */, bool /* print task list */);
|
||||
private:
|
||||
struct task;
|
||||
struct task_recurring;
|
||||
|
Loading…
Reference in New Issue
Block a user