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:
parent
6e3f57118f
commit
f5c343fc93
1 changed files with 6 additions and 1 deletions
|
@ -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);
|
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;
|
return woken;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue