terminology - use 'thread id' instead of 'thread index'
authorBrian Norris <banorris@uci.edu>
Tue, 13 Mar 2012 06:10:26 +0000 (23:10 -0700)
committerBrian Norris <banorris@uci.edu>
Tue, 13 Mar 2012 06:10:26 +0000 (23:10 -0700)
libthreads.c
libthreads.h
model.c
schedule.c
userprog.c

index ff51b6a6519e8b328eb0b2853c6e32f97aeb6cae..8dd05d13da60af38a26124e7c93f0ab85d58503d 100644 (file)
@@ -58,7 +58,7 @@ static int thread_swap(struct thread *old, struct thread *new)
 
 static void thread_dispose(struct thread *t)
 {
-       DEBUG("completed thread %d\n", thread_current()->index);
+       DEBUG("completed thread %d\n", thread_current()->id);
        t->state = THREAD_COMPLETED;
        stack_free(t->stack);
 }
@@ -83,7 +83,7 @@ static int thread_system_next(void)
        next = model->scheduler->next_thread();
        if (next)
                next->state = THREAD_RUNNING;
-       DEBUG("(%d, %d)\n", curr ? curr->index : -1, next ? next->index : -1);
+       DEBUG("(%d, %d)\n", curr ? curr->id : -1, next ? next->id : -1);
        if (!next)
                return 1;
        return thread_swap(model->system_thread, next);
@@ -108,7 +108,7 @@ int thread_create(struct thread *t, void (*start_routine), void *arg)
 
        memset(t, 0, sizeof(*t));
        model_checker_assign_id(t);
-       DEBUG("create thread %d\n", t->index);
+       DEBUG("create thread %d\n", t->id);
 
        t->start_routine = start_routine;
        t->arg = arg;
index bf7acae804bc58a99d85cf883f9cf3d14e8b1bac..084883376f9f020b414cdcd4a41a4bb55c0a0f73 100644 (file)
@@ -15,7 +15,7 @@ struct thread {
        void *arg;
        ucontext_t context;
        void *stack;
-       int index;
+       int id;
        thread_state state;
 };
 
diff --git a/model.c b/model.c
index b44a911b531f6245b5523287d4887cec1a752ab8..ff466ee7772acbdf4a412d19e70bfd160e6c2891 100644 (file)
--- a/model.c
+++ b/model.c
@@ -15,7 +15,7 @@ void model_checker_init(void)
        model = malloc(sizeof(*model));
        memset(model, 0, sizeof(*model));
 
-       /* First thread created (system_thread) will have index 1 */
+       /* First thread created (system_thread) will have id 1 */
        model->used_thread_id = 0;
 
        scheduler_init(model);
@@ -33,5 +33,5 @@ void model_checker_exit(void)
 
 void model_checker_assign_id(struct thread *t)
 {
-       t->index = ++model->used_thread_id;
+       t->id = ++model->used_thread_id;
 }
index 879ee14a12c59edafdca01601a80870d365fe067..3b4d57cf1574500f75b267a49f6bf181e4a09a02 100644 (file)
@@ -59,7 +59,7 @@ static struct thread *dequeue_thread(void)
 
 static void default_add_thread(struct thread *t)
 {
-       DEBUG("thread %d\n", t->index);
+       DEBUG("thread %d\n", t->id);
        enqueue_thread(t);
 }
 
index 8358a58c19ad4471044ae9f82b3291bc285c0356..c27c701591115f9ec903c6a771263bfc3b1bef98 100644 (file)
@@ -8,7 +8,7 @@ static void a(atomic_int *obj)
        int i;
 
        for (i = 0; i < 10; i++) {
-               printf("Thread %d, loop %d\n", thread_current()->index, i);
+               printf("Thread %d, loop %d\n", thread_current()->id, i);
                if (i % 2)
                        atomic_load(obj);
        }