oneshot.h
来自「LINUX 下的 NACHOS 系统 实现系统调度的算法功能」· C头文件 代码 · 共 46 行
H
46 行
// oneshot.h// Routines to emulate a hardware one-shot timer device.//// A one-shot hardware timer generates a CPU interrupt in X milliseconds.// The interrupt will only occur once and not ever X milliseconds.// This means it can be used for implementing time-slicing.//// Remember -- nothing in here is part of Nachos. It is just// an emulation for the hardware that Nachos is running on top of.//// DO NOT CHANGE -- part of the machine emulation////// Adapted from NachOS' timer.cc.//#ifndef ONESHOT_H#define ONESHOT_H#include "copyright.h"#include "utility.h"// The following class defines a hardware one-shot timer. class OneShot{ public: OneShot(VoidFunctionPtr timerHandler, int callArg, int time); // Initialize the timer, to call the interrupt // handler "timerHandler" when the time expands. ~OneShot() {}// Internal routines to the timer emulation -- DO NOT call these void TimerExpired(); // called internally when the hardware // timer generates an interrupt void SetArg(VoidFunctionPtr timerHandler, int callArg, int time); OneShot(); private: VoidFunctionPtr handler; // timer interrupt handler int arg; // argument to pass to interrupt handler};#endif // ONESHOT_H
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?