Signed-off-by: Igor Fedotov <ifedotov@mirantis.com>
void try_aio_wake() {
if (num_running == 1) {
+
+ // we might have some pending IOs submitted after the check
+ // as there is no lock protection for aio_submit.
+ // Hence we might have false conditional trigger.
+ // aio_wait has to handle that hence do not care here.
std::lock_guard<std::mutex> l(lock);
cond.notify_all();
--num_running;
- assert(num_running == 0);
+ assert(num_running >= 0);
} else {
--num_running;
}
aio_callback(aio_callback_priv, ioc->priv);
}
} else {
- ioc->try_aio_wake();
+ ioc->try_aio_wake();
}
}
}