kernel: condvar: broadcast does not always need reschedule

When doing a condition variable broadcast, a full reschedule
is only needed if at least one thread was awakened.

Signed-off-by: Peter Mitsis <peter.mitsis@intel.com>
This commit is contained in:
Peter Mitsis 2024-12-16 12:45:59 -08:00 committed by Benjamin Cabé
commit f5c343fc93

View file

@ -93,7 +93,12 @@ int z_impl_k_condvar_broadcast(struct k_condvar *condvar)
SYS_PORT_TRACING_OBJ_FUNC_EXIT(k_condvar, broadcast, condvar, woken);
z_reschedule(&lock, key);
if (woken == 0) {
k_spin_unlock(&lock, key);
} else {
z_reschedule(&lock, key);
}
return woken;
}