Skip to content

Commit

Permalink
core/cond.c: cond_wait() expect enabled interrupts
Browse files Browse the repository at this point in the history
  • Loading branch information
derMihai committed Oct 24, 2024
1 parent 5c06502 commit ae4e094
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions core/cond.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,14 @@ void cond_init(cond_t *cond)

void cond_wait(cond_t *cond, mutex_t *mutex)
{
unsigned irqstate = irq_disable();
assert(irq_is_enabled());
irq_disable();
thread_t *me = thread_get_active();

mutex_unlock(mutex);
sched_set_status(me, STATUS_COND_BLOCKED);
thread_add_to_list(&cond->queue, me);
irq_restore(irqstate);
irq_enable();
thread_yield_higher();

/*
Expand Down

0 comments on commit ae4e094

Please sign in to comment.