Skip to content

Commit

Permalink
Updated insert_sleeping_task function to try to improve the compelxit…
Browse files Browse the repository at this point in the history
…y time
  • Loading branch information
Test032232 committed Oct 4, 2024
1 parent 3a19267 commit 7194f2d
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 1 deletion.
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

0 comments on commit 7194f2d

Please sign in to comment.