Check the uthread flags for trigger_posix_signal
authorBarret Rhoden <brho@cs.berkeley.edu>
Tue, 10 Jun 2014 21:25:25 +0000 (14:25 -0700)
committerBarret Rhoden <brho@cs.berkeley.edu>
Tue, 10 Jun 2014 21:25:25 +0000 (14:25 -0700)
I think there are some circumstances where current will be set, but the context
is still saved (in the uthread) instead of in the VCPD.

user/pthread/pthread.c

index a371007..7f7f323 100644 (file)
@@ -75,11 +75,13 @@ static void __pthread_trigger_posix_signal(pthread_t thread, int signo,
 {
        int vcoreid = vcore_id();
        struct user_context *ctx;
-       if (current_uthread) {
-               struct preempt_data *vcpd = vcpd_of(vcoreid);
-        ctx = &vcpd->uthread_ctx;
-       } else {
+
+       if (((struct uthread*)thread)->flags & UTHREAD_SAVED) {
                ctx = &thread->uthread.u_ctx;
+       } else {
+               struct preempt_data *vcpd = vcpd_of(vcoreid);
+               assert(current_uthread == thread);
+               ctx = &vcpd->uthread_ctx;
        }
 
        void *temp_tls_desc = get_tls_desc(vcoreid);