mirror of
https://github.com/matrix-construct/construct
synced 2024-12-26 07:23:53 +01:00
ircd::fs::aio: Add iteration tool for kernel completion queue.
This commit is contained in:
parent
881d3116cc
commit
9f534dea17
2 changed files with 13 additions and 0 deletions
|
@ -258,6 +258,18 @@ ircd::fs::aio::write(const fd &fd,
|
|||
return bytes;
|
||||
}
|
||||
|
||||
bool
|
||||
ircd::fs::aio::for_each_completed(const std::function<bool (const request &)> &closure)
|
||||
{
|
||||
assert(system);
|
||||
const size_t max(system->max_events());
|
||||
for(size_t i(system->head->head % max); i != system->head->tail % max; ++i %= max)
|
||||
if(!closure(*reinterpret_cast<const request *>(system->ring[i].data)))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
//
|
||||
// request
|
||||
//
|
||||
|
|
|
@ -17,6 +17,7 @@ namespace ircd::fs::aio
|
|||
struct system;
|
||||
struct request;
|
||||
|
||||
bool for_each_completed(const std::function<bool (const request &)> &);
|
||||
size_t write(const fd &, const const_iovec_view &, const write_opts &);
|
||||
size_t read(const fd &, const const_iovec_view &, const read_opts &);
|
||||
void fdsync(const fd &, const sync_opts &);
|
||||
|
|
Loading…
Reference in a new issue