From a681dbfde123d5edb21d5d18336d7ff53954bde9 Mon Sep 17 00:00:00 2001 From: Florian Fischer <florian.fl.fischer@fau.de> Date: Tue, 5 Jan 2021 11:37:04 +0100 Subject: [PATCH] [IO] only try syscall on Future::submit if it has no dependencies --- emper/io/Future.hpp | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/emper/io/Future.hpp b/emper/io/Future.hpp index 2de6e021..b8728eba 100644 --- a/emper/io/Future.hpp +++ b/emper/io/Future.hpp @@ -164,10 +164,13 @@ class SendFuture : public Future { void submit() { if constexpr (emper::IO_TRY_SYSCALL) { - ssize_t res = ::send(fd, buf, len, offsetOrFlags | MSG_DONTWAIT); + // 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); + if (res > -1 || (errno != EAGAIN && errno != EWOULDBLOCK)) { + complete(res > 0 ? res : -errno); + } } } @@ -186,10 +189,13 @@ class RecvFuture : public Future { void submit() { if constexpr (emper::IO_TRY_SYSCALL) { - ssize_t res = ::recv(fd, buf, len, offsetOrFlags | MSG_DONTWAIT); + // 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); + if (res > -1 || (errno != EAGAIN && errno != EWOULDBLOCK)) { + complete(res > 0 ? res : -errno); + } } } -- GitLab