File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -34,19 +34,19 @@ void cond_init(cond_t *cond)
3434
3535void cond_wait (cond_t * cond , mutex_t * mutex )
3636{
37- unsigned irqstate = irq_disable ();
37+ assert (irq_is_enabled ());
38+ irq_disable ();
3839 thread_t * me = thread_get_active ();
3940
40- mutex_unlock (mutex );
4141 sched_set_status (me , STATUS_COND_BLOCKED );
4242 thread_add_to_list (& cond -> queue , me );
43- irq_restore (irqstate );
43+ irq_enable ();
44+ /* mutex_unlock() might reschedule, so it needs to be called with interrupts
45+ * enabled. */
46+ mutex_unlock (mutex );
4447 thread_yield_higher ();
45-
46- /*
47- * Once we reach this point, the condition variable was signalled,
48- * and we are free to continue.
49- */
48+ /* Once we reach this point, the condition variable was signaled, and we are
49+ * free to continue. */
5050 mutex_lock (mutex );
5151}
5252
You can’t perform that action at this time.
0 commit comments