Fixes warning in pthread.c
authorBarret Rhoden <brho@cs.berkeley.edu>
Tue, 17 Jun 2014 21:07:08 +0000 (14:07 -0700)
committerBarret Rhoden <brho@cs.berkeley.edu>
Tue, 17 Jun 2014 22:48:07 +0000 (15:48 -0700)
Reworks the code slightly to just cast to a uthread right away, instead of
casting or otherwise mucking around each time it is used.

user/pthread/pthread.c

index 7f7f323..7b08cc0 100644 (file)
@@ -70,22 +70,23 @@ static void __pthread_free_stack(struct pthread_tcb *pt);
 static int __pthread_allocate_stack(struct pthread_tcb *pt);
 
 /* Trigger a posix signal on a pthread from vcore context */
-static void __pthread_trigger_posix_signal(pthread_t thread, int signo,
+static void __pthread_trigger_posix_signal(pthread_t pthread, int signo,
                                            struct siginfo *info)
 {
        int vcoreid = vcore_id();
        struct user_context *ctx;
+       struct uthread *uthread = (struct uthread*)pthread;
 
-       if (((struct uthread*)thread)->flags & UTHREAD_SAVED) {
-               ctx = &thread->uthread.u_ctx;
+       if (uthread->flags & UTHREAD_SAVED) {
+               ctx = &uthread->u_ctx;
        } else {
                struct preempt_data *vcpd = vcpd_of(vcoreid);
-               assert(current_uthread == thread);
+               assert(current_uthread == uthread);
                ctx = &vcpd->uthread_ctx;
        }
 
        void *temp_tls_desc = get_tls_desc(vcoreid);
-       set_tls_desc(thread->uthread.tls_desc, vcoreid);
+       set_tls_desc(uthread->tls_desc, vcoreid);
        trigger_posix_signal(signo, info, ctx);
        set_tls_desc(temp_tls_desc, vcoreid);
 }