Changeset 43114c5 in mainline for src/proc/thread.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/proc/thread.c

    re6ba9a3f r43114c5  
    6767void cushion(void)
    6868{
    69         void (*f)(void *) = the->thread->thread_code;
    70         void *arg = the->thread->thread_arg;
     69        void (*f)(void *) = THREAD->thread_code;
     70        void *arg = THREAD->thread_arg;
    7171
    7272        /* this is where each thread wakes up after its creation */
    73         spinlock_unlock(&the->thread->lock);
     73        spinlock_unlock(&THREAD->lock);
    7474        cpu_priority_low();
    7575
     
    8181void thread_init(void)
    8282{
    83         the->thread = NULL;
     83        THREAD = NULL;
    8484        nrdy = 0;
    8585        spinlock_initialize(&threads_lock);
     
    215215restart:
    216216        pri = cpu_priority_high();
    217         spinlock_lock(&the->thread->lock);
    218         if (the->thread->timeout_pending) { /* busy waiting for timeouts in progress */
    219                 spinlock_unlock(&the->thread->lock);
     217        spinlock_lock(&THREAD->lock);
     218        if (THREAD->timeout_pending) { /* busy waiting for timeouts in progress */
     219                spinlock_unlock(&THREAD->lock);
    220220                cpu_priority_restore(pri);
    221221                goto restart;
    222222        }
    223         the->thread->state = Exiting;
    224         spinlock_unlock(&the->thread->lock);
     223        THREAD->state = Exiting;
     224        spinlock_unlock(&THREAD->lock);
    225225        scheduler();
    226226}
     
    248248       
    249249        pri = cpu_priority_high();
    250         spinlock_lock(&the->thread->lock);
    251         the->thread->call_me = call_me;
    252         the->thread->call_me_with = call_me_with;
    253         spinlock_unlock(&the->thread->lock);
     250        spinlock_lock(&THREAD->lock);
     251        THREAD->call_me = call_me;
     252        THREAD->call_me_with = call_me_with;
     253        spinlock_unlock(&THREAD->lock);
    254254        cpu_priority_restore(pri);
    255255}
Note: See TracChangeset for help on using the changeset viewer.