Skip to content

Commit 4dc37e1

Browse files
Merge pull request pmodels#366 from shintaro-iwasaki/pr/fix_pop_timedwait
pool: fix ABTI_pool_pop_timedwait
2 parents d1cd706 + e630885 commit 4dc37e1

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

src/pool/pool.c

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1444,11 +1444,15 @@ ABT_thread ABTI_pool_pop_timedwait(ABTI_pool *p_pool, double abstime_secs)
14441444
ABT_unit unit =
14451445
p_pool->deprecated_def.p_pop_timedwait(ABTI_pool_get_handle(p_pool),
14461446
abstime_secs);
1447-
ABTI_thread *p_thread =
1448-
ABTI_unit_get_thread(ABTI_global_get_global(), unit);
1449-
ABT_thread thread = ABTI_thread_get_handle(p_thread);
1450-
LOG_DEBUG_POOL_POP(p_pool, thread);
1451-
return thread;
1447+
if (unit == ABT_UNIT_NULL) {
1448+
return ABT_THREAD_NULL;
1449+
} else {
1450+
ABTI_thread *p_thread =
1451+
ABTI_unit_get_thread(ABTI_global_get_global(), unit);
1452+
ABT_thread thread = ABTI_thread_get_handle(p_thread);
1453+
LOG_DEBUG_POOL_POP(p_pool, thread);
1454+
return thread;
1455+
}
14521456
}
14531457

14541458
void ABTI_pool_print(ABTI_pool *p_pool, FILE *p_os, int indent)

0 commit comments

Comments
 (0)