-
Florian Fischer authored
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.
2ab9445b