futex: Avoid unnecessary lock
It is not necessary the spin lock to protect atomic operation. Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
This commit is contained in:
parent
f07df42d49
commit
f2e323f06c
1 changed files with 2 additions and 3 deletions
|
@ -74,13 +74,12 @@ int z_impl_k_futex_wait(struct k_futex *futex, int expected,
|
|||
return -EINVAL;
|
||||
}
|
||||
|
||||
key = k_spin_lock(&futex_data->lock);
|
||||
|
||||
if (atomic_get(&futex->val) != (atomic_val_t)expected) {
|
||||
k_spin_unlock(&futex_data->lock, key);
|
||||
return -EAGAIN;
|
||||
}
|
||||
|
||||
key = k_spin_lock(&futex_data->lock);
|
||||
|
||||
ret = z_pend_curr(&futex_data->lock,
|
||||
key, &futex_data->wait_q, timeout);
|
||||
if (ret == -EAGAIN) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue