|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectnachos.machine.Timer
public final class Timer
A hardware timer generates a CPU timer interrupt approximately every 500 clock ticks. This means that it can be used for implementing time-slicing, or for having a thread go to sleep for a specific period of time. The Timer class emulates a hardware timer by scheduling a timer interrupt to occur every time approximately 500 clock ticks pass. There is a small degree of randomness here, so interrupts do not occur exactly every 500 ticks.
| Constructor Summary | |
|---|---|
Timer(Privilege privilege)
Allocate a new timer. |
|
| Method Summary | |
|---|---|
long |
getTime()
Get the current time. |
void |
setInterruptHandler(Runnable handler)
Set the callback to use as a timer interrupt handler. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public Timer(Privilege privilege)
privilege - encapsulates privileged access to the Nachos
machine.| Method Detail |
|---|
public void setInterruptHandler(Runnable handler)
handler - the timer interrupt handler.public long getTime()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||