Skip to content
Snippets Groups Projects
Commit 7fc5e3d2 authored by Florian Fischer's avatar Florian Fischer
Browse files

[IO] add Future subclass API, allow Futures to be linked

Introduce specialized Future subclasses API to the IO subsystem.
For each io::OPERATION request there exists a Class named <Operation>Future
(e.g. AcceptFuture(...), SendFuture(...)) with a constructor matching
the definitions of the known POSIX functions (e.g. accept(2), send(2)).

Using Futures objects instead of the the POSIX like interface provided
by io.hpp gives more Flexibility to the memory management as well
as the possibility to link IO requests.
Futures can be linked by declaring one the dependency of another.
A Future is only signaled if all IO requests it depends on are completed.

Example:

WriteFuture wf(fd, str, str_len, 0);
ReadFuture rf(fd, buf, buf_len, 0);
rf.addDependency(wf);
rf.submitAndWait();

Submitting a Future will also submit all its dependencies to the IO
subsystem.
Manually submitting a Future B which is the dependency of another Future A
before Future A is undefined behavior.

If an IO operation in a chain fails all dependent IO operations will
be completed with -ECANCELED.

Declare the single Future constructor as protected so a user can not
instantiate a plain Future object.
parent e01f15e7
No related branches found
No related tags found
No related merge requests found
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment