+ cpu_flags_t flags;
+
+ /* Sleeping with IRQs disabled or preemption forbidden is illegal */
+ IRQ_ASSERT_ENABLED();
+ ASSERT(proc_allowed());
+
+ /*
+ * This is subtle: there's a race condition where a concurrent
+ * process or an interrupt may call sig_signal() to set a bit in
+ * Process.sig_recv just after we have checked for it, but before
+ * we've set Process.sig_wait to let them know we want to be awaken.
+ *
+ * In this case, we'd deadlock with the signal bit already set
+ * and the process never being reinserted into the ready list.
+ */
+ // FIXME: just use IRQ_DISABLE() here