Changeset 43114c5 in mainline for src/synch/waitq.c


Ignore:
Timestamp:
2005-04-09T18:22:53Z (20 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
8262010
Parents:
e6ba9a3f
Message:

Introduce macros CPU, THREAD, TASK and use them to replace the→cpu, the→thread, the→task.
Later on, this will make it possible to reference *current* cpu, thread and/or task without the aid from virtual memory.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/synch/waitq.c

    re6ba9a3f r43114c5  
    130130         * there are timeouts in progress.
    131131         */
    132         spinlock_lock(&the->thread->lock);
    133         if (the->thread->timeout_pending) {
    134                 spinlock_unlock(&the->thread->lock);
     132        spinlock_lock(&THREAD->lock);
     133        if (THREAD->timeout_pending) {
     134                spinlock_unlock(&THREAD->lock);
    135135                cpu_priority_restore(pri);             
    136136                goto restart;
    137137        }
    138         spinlock_unlock(&the->thread->lock);
     138        spinlock_unlock(&THREAD->lock);
    139139       
    140140        spinlock_lock(&wq->lock);
     
    160160         * Now we are firmly decided to go to sleep.
    161161         */
    162         spinlock_lock(&the->thread->lock);
     162        spinlock_lock(&THREAD->lock);
    163163        if (usec) {
    164164                /* We use the timeout variant. */
    165                 if (!context_save(&the->thread->sleep_timeout_context)) {
     165                if (!context_save(&THREAD->sleep_timeout_context)) {
    166166                        /*
    167167                         * Short emulation of scheduler() return code.
    168168                         */
    169                         spinlock_unlock(&the->thread->lock);
     169                        spinlock_unlock(&THREAD->lock);
    170170                        cpu_priority_restore(pri);
    171171                        return ESYNCH_TIMEOUT;
    172172                }
    173                 the->thread->timeout_pending = 1;
    174                 timeout_register(&the->thread->sleep_timeout, (__u64) usec, waitq_interrupted_sleep, the->thread);
    175         }
    176 
    177         list_append(&the->thread->wq_link, &wq->head);
     173                THREAD->timeout_pending = 1;
     174                timeout_register(&THREAD->sleep_timeout, (__u64) usec, waitq_interrupted_sleep, THREAD);
     175        }
     176
     177        list_append(&THREAD->wq_link, &wq->head);
    178178
    179179        /*
    180180         * Suspend execution.
    181181         */
    182         the->thread->state = Sleeping;
    183         the->thread->sleep_queue = wq;
    184 
    185         spinlock_unlock(&the->thread->lock);
     182        THREAD->state = Sleeping;
     183        THREAD->sleep_queue = wq;
     184
     185        spinlock_unlock(&THREAD->lock);
    186186
    187187        scheduler();    /* wq->lock is released in scheduler_separated_stack() */
Note: See TracChangeset for help on using the changeset viewer.