Subversion Repositories HelenOS-historic

Rev

Rev 1264 | Rev 1433 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1264 Rev 1431
Line 60... Line 60...
60
{
60
{
61
    link_t *l;
61
    link_t *l;
62
    timeout_t *h;
62
    timeout_t *h;
63
    timeout_handler_t f;
63
    timeout_handler_t f;
64
    void *arg;
64
    void *arg;
-
 
65
    int i;
65
 
66
 
66
    /*
67
    /*
67
     * To avoid lock ordering problems,
68
     * To avoid lock ordering problems,
68
     * run all expired timeouts as you visit them.
69
     * run all expired timeouts as you visit them.
69
     */
70
     */
-
 
71
    for (i = 0; i < CPU->missed_clock_ticks; i++) {
70
    spinlock_lock(&CPU->timeoutlock);
72
        spinlock_lock(&CPU->timeoutlock);
71
    while ((l = CPU->timeout_active_head.next) != &CPU->timeout_active_head) {
73
        while ((l = CPU->timeout_active_head.next) != &CPU->timeout_active_head) {
72
        h = list_get_instance(l, timeout_t, link);
74
            h = list_get_instance(l, timeout_t, link);
73
        spinlock_lock(&h->lock);
75
            spinlock_lock(&h->lock);
74
        if (h->ticks-- != 0) {
76
            if (h->ticks-- != 0) {
Line 85... Line 87...
85
        f(arg);
87
            f(arg);
86
 
88
 
87
        spinlock_lock(&CPU->timeoutlock);
89
            spinlock_lock(&CPU->timeoutlock);
88
    }
90
        }
89
    spinlock_unlock(&CPU->timeoutlock);
91
        spinlock_unlock(&CPU->timeoutlock);
-
 
92
    }
-
 
93
    CPU->missed_clock_ticks = 0;
90
 
94
 
91
    /*
95
    /*
92
     * Do CPU usage accounting and find out whether to preempt THREAD.
96
     * Do CPU usage accounting and find out whether to preempt THREAD.
93
     */
97
     */
94
 
98