Reported by Francis Russell <fpr02@doc.ic.ac.uk>.
}
\f
/* Idle thread. Executes when no other thread is ready to run.
-@@ -467,8 +613,10 @@
+@@ -467,11 +613,13 @@
t->status = THREAD_BLOCKED;
strlcpy (t->name, name, sizeof t->name);
t->stack = (uint8_t *) t + PGSIZE;
t->magic = THREAD_MAGIC;
+ sema_init (&t->timer_sema, 0);
+ list_init (&t->donors);
+
+ old_level = intr_disable ();
list_push_back (&all_list, &t->allelem);
+ intr_set_level (old_level);
}
@@ -495,8 +643,14 @@
#endif
/* Remove thread from all threads list, set our status to dying,
-@@ -406,17 +410,28 @@ is_thread (struct thread *t)
+@@ -406,23 +410,34 @@ is_thread (struct thread *t)
/* Does basic initialization of T as a blocked thread named
NAME. */
static void
-init_thread (struct thread *t, const char *name, int priority)
+init_thread (struct thread *t, const char *name, int priority, tid_t tid)
{
+ enum intr_level old_level;
+
ASSERT (t != NULL);
ASSERT (PRI_MIN <= priority && priority <= PRI_MAX);
ASSERT (name != NULL);
+ list_init (&t->mappings);
+ t->next_handle = 2;
t->magic = THREAD_MAGIC;
+
+ old_level = intr_disable ();
+ list_push_back (&all_list, &t->allelem);
+ intr_set_level (old_level);
}
Index: src/threads/thread.h
#endif
/* Remove thread from all threads list, set our status to dying,
-@@ -406,17 +410,29 @@ is_thread (struct thread *t)
+@@ -406,23 +410,35 @@ is_thread (struct thread *t)
/* Does basic initialization of T as a blocked thread named
NAME. */
static void
-init_thread (struct thread *t, const char *name, int priority)
+init_thread (struct thread *t, const char *name, int priority, tid_t tid)
{
+ enum intr_level old_level;
+
ASSERT (t != NULL);
ASSERT (PRI_MIN <= priority && priority <= PRI_MAX);
ASSERT (name != NULL);
+ t->next_handle = 2;
+ t->wd = NULL;
t->magic = THREAD_MAGIC;
+
+ old_level = intr_disable ();
+ list_push_back (&all_list, &t->allelem);
+ intr_set_level (old_level);
}
Index: src/threads/thread.h
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);
t->stack = (uint8_t *) t + PGSIZE;
t->priority = priority;
t->magic = THREAD_MAGIC;
+
+ old_level = intr_disable ();
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