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:
committed by
Benjamin Cabé
parent
f5c343fc93
commit
c6ed03f66a
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user