projects
/
pintos-anon
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
thread: Properly protect 'all_list' around insertion.
[pintos-anon]
/
src
/
threads
/
thread.c
diff --git
a/src/threads/thread.c
b/src/threads/thread.c
index 955ccdcfef958179dd285de2f4049e96c37c77ba..d68c123fb2476420d09557f4f52d4a6fb12949f4 100644
(file)
--- a/
src/threads/thread.c
+++ b/
src/threads/thread.c
@@
-459,6
+459,8
@@
is_thread (struct thread *t)
static void
init_thread (struct thread *t, const char *name, int priority)
{
static void
init_thread (struct thread *t, const char *name, int priority)
{
+ enum intr_level old_level;
+
ASSERT (t != NULL);
ASSERT (PRI_MIN <= priority && priority <= PRI_MAX);
ASSERT (name != NULL);
ASSERT (t != NULL);
ASSERT (PRI_MIN <= priority && priority <= PRI_MAX);
ASSERT (name != NULL);
@@
-469,7
+471,10
@@
init_thread (struct thread *t, const char *name, int priority)
t->stack = (uint8_t *) t + PGSIZE;
t->priority = priority;
t->magic = THREAD_MAGIC;
t->stack = (uint8_t *) t + PGSIZE;
t->priority = priority;
t->magic = THREAD_MAGIC;
+
+ old_level = intr_disable ();
list_push_back (&all_list, &t->allelem);
list_push_back (&all_list, &t->allelem);
+ intr_set_level (old_level);
}
/* Allocates a SIZE-byte frame at the top of thread T's stack and
}
/* Allocates a SIZE-byte frame at the top of thread T's stack and