From 22c9d0432aa485f430f51092e9ad405881c3babc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Franz=20P=C3=B6schel?= Date: Fri, 15 Dec 2023 10:48:48 +0100 Subject: [PATCH] Implement timeout in util_wait_yield_run() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Franz Pöschel --- prov/util/src/util_wait.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/prov/util/src/util_wait.c b/prov/util/src/util_wait.c index d8f035e9050..f2b2361b3a7 100644 --- a/prov/util/src/util_wait.c +++ b/prov/util/src/util_wait.c @@ -593,10 +593,15 @@ static int util_wait_yield_run(struct fid_wait *wait_fid, int timeout) { struct util_wait_yield *wait; struct ofi_wait_fid_entry *fid_entry; + uint64_t endtime; int ret = 0; wait = container_of(wait_fid, struct util_wait_yield, util_wait.wait_fid); + endtime = ofi_timeout_time(timeout); + while (!wait->signal) { + if (ofi_adjust_timeout(endtime, &timeout)) + return -FI_ETIMEDOUT; ofi_mutex_lock(&wait->util_wait.lock); dlist_foreach_container(&wait->util_wait.fid_list, struct ofi_wait_fid_entry,