From 4a9e8c9054619c028f4f619ea3cd9608ccdd46bc Mon Sep 17 00:00:00 2001 From: Matthieu Dorier Date: Wed, 31 Jul 2024 10:32:29 +0100 Subject: [PATCH] added a yield after HG_Progress --- src/margo-core.c | 3 +++ tests/unit-tests/margo-init.c | 5 ++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/margo-core.c b/src/margo-core.c index ecc9644..aad0230 100644 --- a/src/margo-core.c +++ b/src/margo-core.c @@ -1930,6 +1930,9 @@ static inline hg_return_t margo_internal_progress(margo_instance_id mid, monitoring_args.ret = hret; __MARGO_MONITOR(mid, FN_END, progress, monitoring_args); + /* give a chance to other ULTs to get scheduled */ + ABT_thread_yield(); + return hret; } diff --git a/tests/unit-tests/margo-init.c b/tests/unit-tests/margo-init.c index 11548f6..dee606f 100644 --- a/tests/unit-tests/margo-init.c +++ b/tests/unit-tests/margo-init.c @@ -188,7 +188,10 @@ static MunitResult ref_incr_and_release(const MunitParameter params[], void* dat static void kill_test(void* args) { volatile int* x = (int*)args; - sleep(1); + double t = ABT_get_wtime(); + while(ABT_get_wtime() - t < 1.0) { + ABT_thread_yield(); + } if(*x == 1) return; else { x = NULL;