alarm.h

来自「Nachos是个教学用的小型操作系统」· C头文件 代码 · 共 43 行

H
43
字号
// alarm.h //	Data structures for a software alarm clock.////	We make use of a hardware timer device, that generates//	an interrupt every X time ticks (on real systems, X is//	usually between 0.25 - 10 milliseconds).////	From this, we provide the ability for a thread to be//	woken up after a delay; we also provide time-slicing.////	NOTE: this abstraction is not completely implemented.//// Copyright (c) 1992-1996 The Regents of the University of California.// All rights reserved.  See copyright.h for copyright notice and limitation // of liability and disclaimer of warranty provisions.#ifndef ALARM_H#define ALARM_H#include "copyright.h"#include "utility.h"#include "callback.h"#include "timer.h"// The following class defines a software alarm clock. class Alarm : public CallBackObj {  public:    Alarm(bool doRandomYield);	// Initialize the timer, and callback 				// to "toCall" every time slice.    ~Alarm() { delete timer; }        void WaitUntil(int x);	// suspend execution until time > now + x                                // this method is not yet implemented  private:    Timer *timer;		// the hardware timer device    void CallBack();		// called when the hardware				// timer generates an interrupt};#endif // ALARM_H

⌨️ 快捷键说明

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