int64_t return_code;
ceph::coarse_real_clock::time_point start;
IORequest io_request;
+ std::mutex lock;
+ std::condition_variable cond;
Task(NVMEDevice *dev, IOCommand c, uint64_t off, uint64_t l, int64_t rc = 0)
: device(dev), command(c), offset(off), len(l),
return_code(rc),
copied += need_copy;
}
}
+
+ void io_wait() {
+ std::unique_lock<std::mutex> l(lock);
+ cond.wait(l);
+ }
+
+ void io_wake() {
+ std::lock_guard<std::mutex> l(lock);
+ cond.notify_all();
+ }
};
class SharedDriverData {
} else {
task->return_code = 0;
if(!--ctx->num_reading) {
- ctx->aio_wake();
+ task->io_wake();
}
}
} else {
driver->queue_task(t);
while(t->return_code > 0) {
- ioc->aio_wait();
+ t->io_wait();
}
pbl->push_back(std::move(p));
r = t->return_code;
driver->queue_task(t);
while(t->return_code > 0) {
- ioc.aio_wait();
+ t->io_wait();
}
r = t->return_code;
delete t;