From 03a707bee7d872245e5a35299a999b79ded17db6 Mon Sep 17 00:00:00 2001 From: Brian Norris Date: Mon, 12 Mar 2012 23:10:26 -0700 Subject: [PATCH] terminology - use 'thread id' instead of 'thread index' --- libthreads.c | 6 +++--- libthreads.h | 2 +- model.c | 4 ++-- schedule.c | 2 +- userprog.c | 2 +- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/libthreads.c b/libthreads.c index ff51b6a6..8dd05d13 100644 --- a/libthreads.c +++ b/libthreads.c @@ -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; diff --git a/libthreads.h b/libthreads.h index bf7acae8..08488337 100644 --- a/libthreads.h +++ b/libthreads.h @@ -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 b44a911b..ff466ee7 100644 --- 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; } diff --git a/schedule.c b/schedule.c index 879ee14a..3b4d57cf 100644 --- a/schedule.c +++ b/schedule.c @@ -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); } diff --git a/userprog.c b/userprog.c index 8358a58c..c27c7015 100644 --- a/userprog.c +++ b/userprog.c @@ -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); } -- 2.34.1