⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 setabsdeadline.cpp

📁 一个很棒的网络控制系统仿真软件
💻 CPP
字号:
#ifndef SET_ABS_DEADLINE#define SET_ABS_DEADLINE#include "gettask.cpp"#include "findQ.cpp"#include "moveready.cpp"void updateDLTimer(double time, Task* task) {  bool found = false;  TimerNode* tn = (TimerNode*) rtsys->timerQ->getFirst();  while (tn!=NULL && !found) {    Timer* t = tn->getTimer();    if (t->dlORtimer && (t->task == task)) {      found = true;      rtsys->timerQ->removeNode(tn);      // update expiry and insert back in timerQ      t->time = time;      rtsys->timerQ->insertSorted(tn);    } else {      tn = (TimerNode*) tn->getNext();    }  }}// set absolute deadline of specific taskvoid ttSetAbsDeadline(double time, char *nameOfTask) {  TaskNode *tn;  Task* task = getTask(nameOfTask);  if (task == NULL) {    char buf[200];    sprintf(buf, "ttSetAbsDeadline: Non-existent task '%s'!", nameOfTask);    MEX_ERROR(buf);    return;  }    if (task->currentJob == NULL) {    char buf[200];    sprintf(buf, "ttSetAbsDeadline: No running job for '%s'!", nameOfTask);    MEX_ERROR(buf);    return;  }  task->currentJob->absDeadline = time;      // Update deadline overrun timer  if (task->deadlineORhandler != NULL) {    updateDLTimer(time, task);  }      // Reshuffle readyQ?  tn = findInQ(nameOfTask, rtsys->readyQ);  if (tn != NULL) {    rtsys->readyQ->deleteNode(tn);    moveToReadyQ(task);  }}// Set absolute deadline of calling taskvoid ttSetAbsDeadline(double time) {    if (rtsys->executing == NULL) {    MEX_ERROR("ttSetAbsDeadline: No running task!");    return;  }  ttSetAbsDeadline(time, rtsys->executing->name);}#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -