Subversion Repositories HelenOS

Rev

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

Rev 1882 Rev 1888
Line 372... Line 372...
372
    if (THREAD) {
372
    if (THREAD) {
373
        /* must be run after the switch to scheduler stack */
373
        /* must be run after the switch to scheduler stack */
374
        after_thread_ran();
374
        after_thread_ran();
375
 
375
 
376
        switch (THREAD->state) {
376
        switch (THREAD->state) {
377
            case Running:
377
        case Running:
378
            spinlock_unlock(&THREAD->lock);
378
            spinlock_unlock(&THREAD->lock);
379
            thread_ready(THREAD);
379
            thread_ready(THREAD);
380
            break;
380
            break;
381
 
381
 
382
            case Exiting:
382
        case Exiting:
383
repeat:
383
repeat:
384
                if (THREAD->detached) {
384
                if (THREAD->detached) {
385
                thread_destroy(THREAD);
385
                thread_destroy(THREAD);
386
            } else {
386
            } else {
387
                /*
387
                /*
Line 403... Line 403...
403
                THREAD->state = Undead;
403
                THREAD->state = Undead;
404
                spinlock_unlock(&THREAD->lock);
404
                spinlock_unlock(&THREAD->lock);
405
            }
405
            }
406
            break;
406
            break;
407
           
407
           
408
            case Sleeping:
408
        case Sleeping:
409
            /*
409
            /*
410
             * Prefer the thread after it's woken up.
410
             * Prefer the thread after it's woken up.
411
             */
411
             */
412
            THREAD->priority = -1;
412
            THREAD->priority = -1;
413
 
413
 
Line 428... Line 428...
428
 
428
 
429
            spinlock_unlock(&THREAD->lock);
429
            spinlock_unlock(&THREAD->lock);
430
 
430
 
431
            break;
431
            break;
432
 
432
 
433
            default:
433
        default:
434
            /*
434
            /*
435
             * Entering state is unexpected.
435
             * Entering state is unexpected.
436
             */
436
             */
437
            panic("tid%d: unexpected state %s\n", THREAD->tid, thread_states[THREAD->state]);
437
            panic("tid%d: unexpected state %s\n", THREAD->tid, thread_states[THREAD->state]);
438
            break;
438
            break;