group/pintos/src/threads/thread.c
/* Yields the CPU.  The current thread is not put to sleep and
   may be scheduled again immediately at the scheduler's whim. */
Yields the CPU.  The current thread is not put to sleep and
may be scheduled again immediately at the scheduler's whim.
Yields the CPU . The current thread is not put to sleep and may be scheduled again immediately at the scheduler ' s whim .
void
thread_yield (void)
{
  struct thread *cur = thread_current ();
  enum intr_level old_level;
  ASSERT (!intr_context ());
  old_level = intr_disable ();
  if (cur != idle_thread){
    if (thread_mlfqs)
      list_push_back(&mlfqs_lists[cur->priority], &cur->mlfqs_elem);
    list_insert_ordered(&ready_list, &cur->elem,
              thread_priority_cmp, NULL);
  }
  cur->status = THREAD_READY;
  schedule ();
  intr_set_level (old_level);
}
void thread_yield ( void ) { struct thread * cur = thread_current ( ) ; enum intr_level old_level ; ASSERT ( ! intr_context ( ) ) ; old_level = intr_disable ( ) ; if ( cur != idle_thread ) { if ( thread_mlfqs ) list_push_back ( & mlfqs_lists [ cur -> priority ] , & cur -> mlfqs_elem ) ; list_insert_ordered ( & ready_list , & cur -> elem , thread_priority_cmp , NULL ) ; } cur -> status = THREAD_READY ; schedule ( ) ; intr_set_level ( old_level ) ; }
Yields the CPU.
Yields the CPU .
// list_push_back (&ready_list, &cur->elem);