Ignore:
Timestamp:
Aug 14, 2017, 11:39:03 AM (7 years ago)
Author:
alain
Message:

Change Time unit from cycle to TICK (in millisecond).
Fix several bugs in VFS.

File:
1 edited

Legend:

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

    r338 r367  
    638638{
    639639    thread_t * this = CURRENT_THREAD;
    640     return ( (this->local_locks == 0) && (this->remote_locks == 0) );
    641 }
    642 
    643 ///////////////////////////
    644 bool_t thread_check_sched()
     640    return (this->local_locks == 0) && (this->remote_locks == 0);
     641}
     642
     643/////////////////////////
     644void thread_check_sched()
    645645{
    646646    thread_t * this = CURRENT_THREAD;
    647647
    648     // check locks count
    649     if( (this->local_locks != 0) || (this->remote_locks != 0) )
    650         return false;
    651 
    652     if( this->flags & THREAD_FLAG_SCHED )
     648        if( (this->local_locks == 0) &&
     649        (this->remote_locks == 0) &&
     650        (this->flags & THREAD_FLAG_SCHED) )
     651    {
     652        this->flags &= ~THREAD_FLAG_SCHED;
    653653        sched_yield( NULL );
    654 
    655     return true;
    656 
    657 #if 0
    658     // compute elapsed time, taking into account 32 bits register wrap
    659     uint32_t elapsed;
    660     uint32_t time_now   = hal_get_cycles();
    661     uint32_t time_last  = this->time_last_check;
    662     if( time_now < time_last ) elapsed = (0xFFFFFFFF - time_last) + time_now;
    663         else                       elapsed = time_now - time_last;
    664 
    665     // update thread time
    666     this->time_last_check = time_now;
    667 
    668         // check elapsed time
    669         if( elapsed < CONFIG_CORE_CHECK_EVERY ) return false;
    670     else                                    return true;
    671 #endif
     654    }
    672655}
    673656
Note: See TracChangeset for help on using the changeset viewer.