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

[IO] only try syscall on Future::submit if it has no dependencies

parent 3b7a60ff
No related branches found
No related tags found
No related merge requests found
Checking pipeline status
......@@ -164,12 +164,15 @@ class SendFuture : public Future {
void submit() {
if constexpr (emper::IO_TRY_SYSCALL) {
// Only try to complete using a syscall if we have no dependencies
if (!dependency) {
ssize_t res = ::send(fd, buf, len, offsetOrFlags | MSG_DONTWAIT);
if (res > -1 || (errno != EAGAIN && errno != EWOULDBLOCK)) {
complete(res > 0 ? res : -errno);
}
}
}
Future::submit();
}
......@@ -186,12 +189,15 @@ class RecvFuture : public Future {
void submit() {
if constexpr (emper::IO_TRY_SYSCALL) {
// Only try to complete using a syscall if we have no dependencies
if (!dependency) {
ssize_t res = ::recv(fd, buf, len, offsetOrFlags | MSG_DONTWAIT);
if (res > -1 || (errno != EAGAIN && errno != EWOULDBLOCK)) {
complete(res > 0 ? res : -errno);
}
}
}
Future::submit();
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment