+static inline void must_inline
+__try_wait(bool check_stall)
+{
+ unsigned int nstall;
+ waitq_t* current_wq = ¤t_thread->waitqueue;
+ if (waitq_empty(current_wq)) {
+ return;
+ }
+
+ block_current_thread();
+
+ if (!check_stall) {
+ // if we are not checking stall, we give up voluntarily
+ yield_current();
+ } else {
+ // otherwise, treat it as being preempted by kernel
+ preempt_current();
+ }
+
+ // In case of SIGINT-forced awaken
+ llist_delete(¤t_wq->waiters);
+}
+
+static inline void must_inline
+__pwait(waitq_t* queue, bool check_stall)