projects
/
pintos-anon
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
f8c3387
)
Call thread_yield() in timer_sleep() if interrupts are on.
author
Ben Pfaff
<blp@cs.stanford.edu>
Sat, 11 Sep 2004 23:16:45 +0000
(23:16 +0000)
committer
Ben Pfaff
<blp@cs.stanford.edu>
Sat, 11 Sep 2004 23:16:45 +0000
(23:16 +0000)
src/devices/timer.c
patch
|
blob
|
history
diff --git
a/src/devices/timer.c
b/src/devices/timer.c
index 8f4838f048e04ec80d0060fc10cd1a3d77da3216..200d58f8251e0b660bd3a4fa49367b337a882857 100644
(file)
--- a/
src/devices/timer.c
+++ b/
src/devices/timer.c
@@
-3,6
+3,7
@@
#include <round.h>
#include "threads/interrupt.h"
#include "threads/io.h"
#include <round.h>
#include "threads/interrupt.h"
#include "threads/io.h"
+#include "threads/thread.h"
#if TIMER_FREQ < 19
#error 8254 timer requires TIMER_FREQ >= 19
#if TIMER_FREQ < 19
#error 8254 timer requires TIMER_FREQ >= 19
@@
-55,14
+56,15
@@
timer_elapsed (int64_t then)
return timer_ticks () - then;
}
return timer_ticks () - then;
}
-/* Suspends execution
s
for approximately TICKS timer ticks. */
+/* Suspends execution for approximately TICKS timer ticks. */
void
timer_sleep (int64_t ticks)
{
int64_t start = timer_ticks ();
while (timer_elapsed (start) < ticks)
void
timer_sleep (int64_t ticks)
{
int64_t start = timer_ticks ();
while (timer_elapsed (start) < ticks)
- continue;
+ if (intr_get_level () == INTR_ON)
+ thread_yield ();
}
/* Returns MS milliseconds in timer ticks, rounding up. */
}
/* Returns MS milliseconds in timer ticks, rounding up. */