Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated insert_sleeping_task function to try to improve the complexity time #781

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added .DS_Store
Binary file not shown.
Binary file added src/.DS_Store
Binary file not shown.
Binary file added src/internal_modules/.DS_Store
Binary file not shown.
13 changes: 12 additions & 1 deletion src/internal_modules/roc_ctl/control_task_queue.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -824,7 +824,7 @@ ControlTask* ControlTaskQueue::fetch_sleeping_task_() {
return task;
}

void ControlTaskQueue::insert_sleeping_task_(ControlTask& task) {
/*void ControlTaskQueue::insert_sleeping_task_(ControlTask& task) {
roc_panic_if_not(task.effective_deadline_ > 0);

ControlTask* pos = sleeping_queue_.front();
Expand All @@ -841,6 +841,17 @@ void ControlTaskQueue::insert_sleeping_task_(ControlTask& task) {
sleeping_queue_.push_back(task);
}
}
*/


// Define the priority queue for sleeping tasks with a std::greater comparator
std::priority_queue<ControlTask*, std::vector<ControlTask*>, std::greater<>> sleeping_queue_;

void ControlTaskQueue::insert_sleeping_task_(ControlTask& task) {
roc_panic_if_not(task.effective_deadline_ > 0);
// Push the task into the priority queue
sleeping_queue_.push(&task);
}

void ControlTaskQueue::remove_sleeping_task_(ControlTask& task) {
roc_panic_if_not(task.effective_deadline_ > 0);
Expand Down
Loading