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

📄 oneshot.h

📁 LINUX 下的 NACHOS 系统 实现系统调度的算法功能
💻 H
字号:
// 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 + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -