kernel: futex: Allow for fast return on k_futex_wake()

Updates k_futex_wake() to allow for a fast return path when no threads
were waiting.

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

View file

@ -47,7 +47,11 @@ int z_impl_k_futex_wake(struct k_futex *futex, bool wake_all)
}
} while (thread && wake_all);
z_reschedule(&futex_data->lock, key);
if (woken == 0) {
k_spin_unlock(&futex_data->lock, key);
} else {
z_reschedule(&futex_data->lock, key);
}
return woken;
}