Skip to content

Commit

Permalink
kernel: fix asserts in kcond_wait and kcond_wait_timeout
Browse files Browse the repository at this point in the history
  • Loading branch information
rasky committed Nov 3, 2024
1 parent a17c800 commit d8c7321
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/kernel/kernel.c
Original file line number Diff line number Diff line change
Expand Up @@ -910,7 +910,7 @@ void kcond_wait(kcond_t *cond, kmutex_t *mutex)
disable_interrupts();
if (mutex) {
assertf(mutex->owner == PhysicalAddr(th), "kcond_wait() called, but mutex is not locked by %s[%p]", th->name, th);
assertf(mutex->counter != 1, "kcond_wait() called, but mutex is locked multiple times");
assertf(mutex->counter == 1, "kcond_wait() called, but mutex is locked multiple times");

// Unlock the mutex, and put the thread in the cond waiting list
kmutex_unlock_internal(mutex);
Expand All @@ -932,7 +932,7 @@ bool kcond_wait_timeout(kcond_t *cond, kmutex_t *mutex, uint32_t ticks)

disable_interrupts();
assertf(mutex->owner == PhysicalAddr(th), "kcond_wait_timeout() called, but mutex is not locked by %s[%p]", th->name, th);
assertf(mutex->counter != 1, "kcond_wait_timeout() called, but mutex is locked multiple times");
assertf(mutex->counter == 1, "kcond_wait_timeout() called, but mutex is locked multiple times");

// Unlock the mutex, and put the thread in the cond waiting list
kmutex_unlock_internal(mutex);
Expand Down

0 comments on commit d8c7321

Please sign in to comment.