On 10/05/21 13:56, Vladimir Sementsov-Ogievskiy wrote:
+ }
- if (task->ret < 0 && pool->status == 0) {
- pool->status = task->ret;
+ if (ret < 0) {
+ qatomic_cmpxchg(&pool->status, 0, ret);
}
Can we just do it inside critical section above and avoid extra cmpxchg?
We'll need just qatomic_set as a pair to qatomic_read()
Good idea.
g_free(task);
- if (pool->waiting) {
- pool->waiting = false;
- aio_co_wake(pool->main_co);
- }
+ qemu_co_queue_next(&pool->queue);
this call doesn't need mutex protection?
It does indeed.
I second the idea of "stealing" Denis's two patches to block/aio_task
and only adding the mutex (plus qatomic_read/set) here.
Paolo
Then we should modify comment
insid AioTaskPool structure.
Anyway, I think it's simpler to just have one QEMU_MUTEX_GUARD() for the
whole function.