Browse Source

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>
pull/85097/head
Peter Mitsis 7 months ago committed by Benjamin Cabé
parent
commit
f5c343fc93
  1. 7
      kernel/condvar.c

7
kernel/condvar.c

@ -93,7 +93,12 @@ int z_impl_k_condvar_broadcast(struct k_condvar *condvar) @@ -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;
}

Loading…
Cancel
Save