- thread_create ("idle", PRI_MIN, idle, NULL);
+ /* Create the idle thread with maximum priority. This ensures
+ that it will be scheduled soon after interrupts are enabled.
+ The idle thread will block almost immediately upon
+ scheduling, and subsequently it will never appear on the
+ ready list, so the priority here is otherwise
+ unimportant. */
+ struct semaphore idle_started;
+ sema_init (&idle_started, 0);
+ thread_create ("idle", PRI_MAX, idle, &idle_started);
+
+ /* Start preemptive thread scheduling. */