Changeset 43114c5 in mainline for test/synch/rwlock4/test.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
  • test/synch/rwlock4/test.c

    re6ba9a3f r43114c5  
    7474
    7575        to = random(40000);
    76         printf("cpu%d, tid %d w+ (%d)\n", the->cpu->id, the->thread->tid, to);
     76        printf("cpu%d, tid %d w+ (%d)\n", CPU->id, THREAD->tid, to);
    7777        rc = rwlock_write_lock_timeout(&rwlock, to);
    7878        if (SYNCH_FAILED(rc)) {
    79                 printf("cpu%d, tid %d w!\n", the->cpu->id, the->thread->tid);
     79                printf("cpu%d, tid %d w!\n", CPU->id, THREAD->tid);
    8080                return;
    8181        };
    82         printf("cpu%d, tid %d w=\n", the->cpu->id, the->thread->tid);
     82        printf("cpu%d, tid %d w=\n", CPU->id, THREAD->tid);
    8383
    8484        if (rwlock.readers_in) panic("Oops.");
     
    8787
    8888        rwlock_write_unlock(&rwlock);
    89         printf("cpu%d, tid %d w-\n", the->cpu->id, the->thread->tid);   
     89        printf("cpu%d, tid %d w-\n", CPU->id, THREAD->tid);     
    9090}
    9191
     
    9696       
    9797        to = random(2000);
    98         printf("cpu%d, tid %d r+ (%d)\n", the->cpu->id, the->thread->tid, to);
     98        printf("cpu%d, tid %d r+ (%d)\n", CPU->id, THREAD->tid, to);
    9999        rc = rwlock_read_lock_timeout(&rwlock, to);
    100100        if (SYNCH_FAILED(rc)) {
    101                 printf("cpu%d, tid %d r!\n", the->cpu->id, the->thread->tid);
     101                printf("cpu%d, tid %d r!\n", CPU->id, THREAD->tid);
    102102                return;
    103103        }
    104         printf("cpu%d, tid %d r=\n", the->cpu->id, the->thread->tid);
     104        printf("cpu%d, tid %d r=\n", CPU->id, THREAD->tid);
    105105        thread_usleep(30000);
    106106        rwlock_read_unlock(&rwlock);
    107         printf("cpu%d, tid %d r-\n", the->cpu->id, the->thread->tid);           
     107        printf("cpu%d, tid %d r-\n", CPU->id, THREAD->tid);             
    108108}
    109109
     
    135135                printf("Creating %d readers\n", k);
    136136                for (i=0; i<k; i++) {
    137                         thrd = thread_create(reader, NULL, the->task, 0);
     137                        thrd = thread_create(reader, NULL, TASK, 0);
    138138                        if (thrd)
    139139                                thread_ready(thrd);
     
    145145                printf("Creating %d writers\n", k);
    146146                for (i=0; i<k; i++) {
    147                         thrd = thread_create(writer, NULL, the->task, 0);
     147                        thrd = thread_create(writer, NULL, TASK, 0);
    148148                        if (thrd)
    149149                                thread_ready(thrd);
Note: See TracChangeset for help on using the changeset viewer.