@@ -672,8 +672,7 @@ bool aio_poll(AioContext *ctx, bool blocking)
if (use_notify_me) {
/* Finish the poll before clearing the flag. */
- qatomic_store_release(&ctx->notify_me,
- qatomic_read(&ctx->notify_me) - 2);
+ qatomic_fetch_sub(&ctx->notify_me, 2);
}
aio_notify_accept(ctx);
@@ -387,8 +387,7 @@ bool aio_poll(AioContext *ctx, bool blocking)
ret = WaitForMultipleObjects(count, events, FALSE, timeout);
if (blocking) {
assert(first);
- qatomic_store_release(&ctx->notify_me,
- qatomic_read(&ctx->notify_me) - 2);
+ qatomic_fetch_sub(&ctx->notify_me, 2);
aio_notify_accept(ctx);
}
@@ -330,7 +330,7 @@ aio_ctx_check(GSource *source)
BHListSlice *s;
/* Finish computing the timeout before clearing the flag. */
- qatomic_store_release(&ctx->notify_me, qatomic_read(&ctx->notify_me) & ~1);
+ qatomic_fetch_and(&ctx->notify_me, ~1);
aio_notify_accept(ctx);
QSLIST_FOREACH_RCU(bh, &ctx->bh_list, next) {
Replaces the pattern `atomic_store(atomic_load() <op> something)` pattern with its direct atomic function. Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com> --- Note: these previously used RELEASE ordering for the store and `relaxed` ordering for the reads, while the replacement uses SEQ_CST, as there are no other wrappers around yet. Should we add `qatomic_fetch_{sub,and}_release` variants? util/aio-posix.c | 3 +-- util/aio-win32.c | 3 +-- util/async.c | 2 +- 3 files changed, 3 insertions(+), 5 deletions(-)