Ignore:
Timestamp:
Feb 20, 2018, 5:32:17 PM (4 years ago)
Author:
alain
Message:

Fix a bad bug in scheduler...

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/kernel/kern/scheduler.c

    r433 r435  
    280280    }
    281281
    282     // enter critical section / save SR in current thread context
    283     hal_disable_irq( &current->save_sr );
     282    // enter critical section / save SR in current thread descriptor
     283    hal_disable_irq( &CURRENT_THREAD->save_sr );
    284284
    285285    // loop on threads to select next thread
     
    321321        }
    322322
    323         // switch CPU from calling thread context to new thread context
     323        // switch CPU from current thread context to new thread context
    324324        hal_do_cpu_switch( current->cpu_context, next->cpu_context );
    325325    }
     
    330330uint32_t cycle = (uint32_t)hal_get_cycles();
    331331if( CONFIG_DEBUG_SCHED_YIELD < cycle )
    332 printk("\n[DBG] %s : core[%x,%d] / cause = %s / thread %x (%s) (%x,%x) continue / cycle %d\n",
     332printk("\n[DBG] %s : core[%x,%d] / cause = %s\n"
     333"      thread %x (%s) (%x,%x) continue / cycle %d\n",
    333334__FUNCTION__, local_cxy, core->lid, cause,
    334335current, thread_type_str(current->type), current->process->pid, current->trdid, cycle );
     
    340341    sched_handle_signals( core );
    341342
    342     // exit critical section / restore SR from next thread context
    343     hal_restore_irq( next->save_sr );
     343    // exit critical section / restore SR from current thread descriptor
     344    hal_restore_irq( CURRENT_THREAD->save_sr );
    344345
    345346}  // end sched_yield()
Note: See TracChangeset for help on using the changeset viewer.