Il ven 16 mag 2025, 08:58 Akihiko Odaki <akihiko.od...@daynix.com> ha
scritto:

> I also found smp_mb__after_rmw() before qemu_futex_wake_all() is no
> longer necessary. Summing up, I think the code should look like as follows:
>
> #ifdef HAVE_FUTEX
>

You would still need smp_mb__before_rmw() here.

     if (qatomic_xchg(&ev->value, EV_SET) == EV_BUSY) {
>

Removing the qatomic_read() works, but it's more expensive in the case that
the event is already set.

The barrier before qemu_futex_wake_all(ev) could be unnecessary because
there is probably one in FUTEX_WAKE. But not being able to audit Windows
makes me a bit uneasy about it.

Paolo


         /* There were waiters, wake them up.  */
>          qemu_futex_wake_all(ev);
>      }

#else
>      pthread_mutex_lock(&ev->lock);
>      qatomic_store_release(&ev->value, EV_SET);
>      pthread_cond_broadcast(&ev->cond);
>      pthread_mutex_unlock(&ev->lock);
> #endif
>
> Regards,
> Akihiko Odaki
>
>

Reply via email to