+}
+
+static inline void must_inline
+__pwait(waitq_t* queue, bool check_stall)
+{
+ // prevent race condition.
+ no_preemption();
+
+ prepare_to_wait(queue);
+ __try_wait(check_stall);
+
+ set_preemption();
+}
+
+void
+pwait(waitq_t* queue)
+{
+ __pwait(queue, false);
+}
+
+void
+pwait_check_stall(waitq_t* queue)
+{
+ __pwait(queue, true);