| 210 | } |
| 211 | |
| 212 | void AsyncPread(int fd, void* buf, size_t count, off_t offset) { |
| 213 | if (num_readings_ == kAioQueueDepth) { WaitUntilDone(); } |
| 214 | struct iocb* cb = &cbs_.at(num_readings_); |
| 215 | cb->aio_fildes = fd; |
| 216 | cb->aio_lio_opcode = IOCB_CMD_PREAD; |
| 217 | cb->aio_reqprio = 0; |
| 218 | cb->aio_buf = reinterpret_cast<uintptr_t>(buf); |
| 219 | cb->aio_nbytes = count; |
| 220 | cb->aio_offset = offset; |
| 221 | const long nr = 1; |
| 222 | PCHECK(syscall(__NR_io_submit, ctx_, nr, &cbs_ptr_.at(num_readings_)) >= 0); |
| 223 | num_readings_ += 1; |
| 224 | } |
| 225 | |
| 226 | void WaitUntilDone() { |
| 227 | if (num_readings_ != 0) { |