From e6308850957b99f35e0401b7240806e5e2bb3347 Mon Sep 17 00:00:00 2001 From: Shintaro Iwasaki Date: Sun, 22 Aug 2021 23:47:25 -0500 Subject: [PATCH] pool: fix ABTI_pool_pop_timedwait ABTI_pool_pop_timedwait() does not properly handle ABT_UNIT_NULL. This patch adds a branch to deal with ABT_UNIT_NULL. --- src/pool/pool.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/pool/pool.c b/src/pool/pool.c index 40df48cc..2a4cd9f0 100644 --- a/src/pool/pool.c +++ b/src/pool/pool.c @@ -1444,11 +1444,15 @@ ABT_thread ABTI_pool_pop_timedwait(ABTI_pool *p_pool, double abstime_secs) ABT_unit unit = p_pool->deprecated_def.p_pop_timedwait(ABTI_pool_get_handle(p_pool), abstime_secs); - ABTI_thread *p_thread = - ABTI_unit_get_thread(ABTI_global_get_global(), unit); - ABT_thread thread = ABTI_thread_get_handle(p_thread); - LOG_DEBUG_POOL_POP(p_pool, thread); - return thread; + if (unit == ABT_UNIT_NULL) { + return ABT_THREAD_NULL; + } else { + ABTI_thread *p_thread = + ABTI_unit_get_thread(ABTI_global_get_global(), unit); + ABT_thread thread = ABTI_thread_get_handle(p_thread); + LOG_DEBUG_POOL_POP(p_pool, thread); + return thread; + } } void ABTI_pool_print(ABTI_pool *p_pool, FILE *p_os, int indent)