Export uthread_has_blocked()
authorBarret Rhoden <brho@cs.berkeley.edu>
Tue, 11 Aug 2015 19:15:42 +0000 (15:15 -0400)
committerBarret Rhoden <brho@cs.berkeley.edu>
Mon, 28 Sep 2015 19:14:00 +0000 (15:14 -0400)
And make the existence of a 2LS op mandatory.  I was tempted to remove
this completely, but I like hiding the sched ops and enforcing that
there was a has_blocked op, just like with uthread_runnable() (it caught
a bug).

user/parlib/include/uthread.h
user/parlib/uthread.c

index bf8c8c4..2f3ca1e 100644 (file)
@@ -81,6 +81,7 @@ void uthread_yield(bool save_state, void (*yield_func)(struct uthread*, void*),
                    void *yield_arg);
 void uthread_sleep(unsigned int seconds);
 void uthread_usleep(unsigned int usecs);
+void uthread_has_blocked(struct uthread *uthread, int flags);
 
 /* Utility functions */
 bool __check_preempt_pending(uint32_t vcoreid);        /* careful: check the code */
index f10bb47..22ab2fd 100644 (file)
@@ -321,8 +321,8 @@ void uthread_runnable(struct uthread *uthread)
  * AKA: obviously_a_uthread_has_blocked_in_lincoln_park() */
 void uthread_has_blocked(struct uthread *uthread, int flags)
 {
-       if (sched_ops->thread_has_blocked)
-               sched_ops->thread_has_blocked(uthread, flags);
+       assert(sched_ops->thread_has_blocked);
+       sched_ops->thread_has_blocked(uthread, flags);
 }
 
 /* Need to have this as a separate, non-inlined function since we clobber the