Subversion Repositories HelenOS-historic

Rev

Rev 125 | Rev 391 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 125 Rev 221
Line 82... Line 82...
82
    /*
82
    /*
83
     * Do CPU usage accounting and find out whether to preempt THREAD.
83
     * Do CPU usage accounting and find out whether to preempt THREAD.
84
     */
84
     */
85
 
85
 
86
    if (THREAD) {
86
    if (THREAD) {
-
 
87
        __u64 ticks;
-
 
88
       
87
        spinlock_lock(&CPU->lock);
89
        spinlock_lock(&CPU->lock);
88
        CPU->needs_relink++;
90
        CPU->needs_relink++;
89
        spinlock_unlock(&CPU->lock);   
91
        spinlock_unlock(&CPU->lock);   
90
   
92
   
91
        spinlock_lock(&THREAD->lock);
93
        spinlock_lock(&THREAD->lock);
-
 
94
        if (ticks = THREAD->ticks)
92
        if (!THREAD->ticks--) {
95
            THREAD->ticks--;
93
            spinlock_unlock(&THREAD->lock);
96
        spinlock_unlock(&THREAD->lock);
-
 
97
       
-
 
98
        if (!ticks && !PREEMPTION_DISABLED) {
94
            scheduler();
99
            scheduler();
95
        }
100
        }
96
        else {
-
 
97
            spinlock_unlock(&THREAD->lock);
-
 
98
        }
-
 
99
    }
101
    }
100
 
102
 
101
}
103
}