Pthread code calls uthread_runnable() consistently
authorBarret Rhoden <brho@cs.berkeley.edu>
Wed, 18 Apr 2012 19:23:53 +0000 (12:23 -0700)
committerBarret Rhoden <brho@cs.berkeley.edu>
Wed, 18 Apr 2012 19:23:53 +0000 (12:23 -0700)
We were doing a mix of calling the schedop directly and indirectly
(uth_runnable).  This is a little slower, but all paths involving waking
up a uthread go through the same code now.  External code (e.g. mutex
libraries) will use uthread_runnable().

user/pthread/pthread.c

index b0fda20..6c7d476 100644 (file)
@@ -155,7 +155,7 @@ void pth_thread_yield(struct uthread *uthread)
                                /* they joined before we exited, we need to wake them */
                                printd("[pth] %08p exiting, waking joiner %08p\n",
                                       pthread, temp_pth);
-                               pth_thread_runnable((struct uthread*)temp_pth);
+                               uthread_runnable((struct uthread*)temp_pth);
                        }
                }
        } else if (pthread->flags & PTHREAD_JOINING) {
@@ -172,12 +172,12 @@ void pth_thread_yield(struct uthread *uthread)
                        /* wake ourselves, not the exited one! */
                        printd("[pth] %08p already exit, rewaking ourselves, joiner %08p\n",
                               temp_pth, pthread);
-                       pth_thread_runnable((struct uthread*)pthread);
+                       uthread_runnable((struct uthread*)pthread);
                }
        } else {
                /* Yielding for no apparent reason (being nice / help break deadlocks).
                 * Just wake it up and make it ready again. */
-               pth_thread_runnable((struct uthread*)pthread);
+               uthread_runnable((struct uthread*)pthread);
        }
 }