Browse Source

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

6
kernel/futex.c

@ -47,7 +47,11 @@ int z_impl_k_futex_wake(struct k_futex *futex, bool wake_all) @@ -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;
}

Loading…
Cancel
Save