Subversion Repositories HelenOS

Rev

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

Rev 2089 Rev 2183
Line 43... Line 43...
43
#include <func.h>
43
#include <func.h>
44
#include <cpu.h>
44
#include <cpu.h>
45
#include <arch/asm.h>
45
#include <arch/asm.h>
46
#include <arch.h>
46
#include <arch.h>
47
 
47
 
48
 
-
 
49
/** Initialize timeouts
48
/** Initialize timeouts
50
 *
49
 *
51
 * Initialize kernel timeouts.
50
 * Initialize kernel timeouts.
52
 *
51
 *
53
 */
52
 */
Line 173... Line 172...
173
bool timeout_unregister(timeout_t *t)
172
bool timeout_unregister(timeout_t *t)
174
{
173
{
175
    timeout_t *hlp;
174
    timeout_t *hlp;
176
    link_t *l;
175
    link_t *l;
177
    ipl_t ipl;
176
    ipl_t ipl;
-
 
177
    DEADLOCK_PROBE_INIT(p_tolock);
178
 
178
 
179
grab_locks:
179
grab_locks:
180
    ipl = interrupts_disable();
180
    ipl = interrupts_disable();
181
    spinlock_lock(&t->lock);
181
    spinlock_lock(&t->lock);
182
    if (!t->cpu) {
182
    if (!t->cpu) {
Line 184... Line 184...
184
        interrupts_restore(ipl);
184
        interrupts_restore(ipl);
185
        return false;
185
        return false;
186
    }
186
    }
187
    if (!spinlock_trylock(&t->cpu->timeoutlock)) {
187
    if (!spinlock_trylock(&t->cpu->timeoutlock)) {
188
        spinlock_unlock(&t->lock);
188
        spinlock_unlock(&t->lock);
189
        interrupts_restore(ipl);       
189
        interrupts_restore(ipl);
-
 
190
        DEADLOCK_PROBE(p_tolock, DEADLOCK_THRESHOLD);
190
        goto grab_locks;
191
        goto grab_locks;
191
    }
192
    }
192
   
193
   
193
    /*
194
    /*
194
     * Now we know for sure that t hasn't been activated yet
195
     * Now we know for sure that t hasn't been activated yet