struct WaitForFlush {
int flushed() {
if (count.dec() == 0) {
- if (c != NULL) {
- finish_aio_completion(c, 0);
- }
+ aio_finisher->queue(new FunctionContext(boost::bind(
+ &finish_aio_completion, c, 0)));
delete this;
}
return 0;
}
atomic_t count;
+ Finisher *aio_finisher;
AioCompletionImpl *c;
};
WaitForFlush *wait_for_flush = new WaitForFlush();
wait_for_flush->count.set(m_finishers.size());
+ wait_for_flush->aio_finisher = m_aio_finisher;
wait_for_flush->c = c;
for (size_t i = 0; i < m_finishers.size(); ++i) {
AioFunctionContext *ctx = new AioFunctionContext(
boost::bind(&WaitForFlush::flushed, wait_for_flush),
- m_aio_finisher, NULL);
+ nullptr, nullptr);
m_finishers[i]->queue(ctx);
}
}