📄 exitmonitor.cpp
字号:
#ifndef EXIT_MONITOR#define EXIT_MONITOR#include "moveready.cpp"void ttExitMonitor(char *nameOfMonitor) { MonitorNode* mn; Monitor* mon; TaskNode* tn; mn = (MonitorNode*) rtsys->monitorList->getFirst(); while (mn != NULL) { mon = mn->getMonitor(); if (mon->name != NULL) { if (strcmp(mon->name, nameOfMonitor) == 0) break; } mn = (MonitorNode*) mn->getNext(); } if (mn == NULL) { // Monitor does not exist char buf[200]; sprintf(buf, "ttExitMonitor: Non-existent monitor '%s'!", nameOfMonitor); MEX_ERROR(buf); return; } if (mon->heldBy != rtsys->executing) { MEX_ERROR("ttExitMonitor: Only the task holding the monitor can exit from it!"); } mon = mn->getMonitor(); mon->heldBy = NULL; tn = (TaskNode*) mon->waitingQ->getFirst(); if (tn != NULL) { moveToReadyQ(tn->getTask()); mon->heldBy = tn->getTask(); mon->waitingQ->deleteNode(tn); } rtsys->executing->priority = rtsys->executing->assignedPriority;}#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -