parlib: Add the uthread_is_thread0() helper
authorBarret Rhoden <brho@cs.berkeley.edu>
Thu, 7 Jun 2018 18:58:12 +0000 (14:58 -0400)
committerBarret Rhoden <brho@cs.berkeley.edu>
Thu, 7 Jun 2018 18:58:12 +0000 (14:58 -0400)
Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
user/parlib/include/parlib/uthread.h

index c1fa2d8..f1df807 100644 (file)
@@ -211,6 +211,11 @@ static inline bool cur_uth_is_sw_ctx(void)
        return get_cur_uth_ctx()->type == ROS_SW_CTX;
 }
 
+static inline bool uthread_is_thread0(struct uthread *uth)
+{
+       return uth->flags & UTHREAD_IS_THREAD0;
+}
+
 #define uthread_set_tls_var(uth, name, val)                                    \
 ({                                                                             \
        typeof(val) __val = val;                                                   \